array variables availability in ProRealTime – examples and discussions
05/22/2020 at 3:17 PM #132843
As usual double posting just leads to confusion and wasted time which is why it is a forum rule not to double post. So far Nole djole you have broken two forum rules in just four posts as well as spamming the forums with requests for Nicolas to contact you. If you have a question then post it as a topic in the (correct) forum and perhaps someone will help you. If you want to use Nicolas’ professional programming services then follow the instructions under ‘Help’ and then pay him for the use of his professional programming services.
This topic is about arrays…. now do you have a question about arrays? If not then stop posting here or in any other topic where your post is not relevant!06/07/2020 at 1:50 PM #13503206/07/2020 at 5:12 PM #13507106/07/2020 at 5:23 PM #13507707/22/2020 at 11:59 PM #139931
Hi everybody !
I have just discovered that the MTF indicators have been available for some time ago and I am very happy with this opportunity.
I’d like to have more explanations if possible.
Before getting there, I have here 2 examples which, if they are in line with the MTF, associated with the array variables, this would mean that I have understood the process.
Another thing, can you please give us other simple examples as you promised? With everyday indicators like STO, RSI MM and so on…
That’s why I’m here to ask for some help for a better understanding in this code.
I propose 2 situations to be examined one after other.
The first :
IS IT POSSIBLE TO CODE THIS WITH ARRAY VARIABLES AND MTF INDICATORS, BECAUSE WE ENTER IN CODING THE FUTURE (Anticipation over 3 periods ahead):
I want to take a bullish position on H4 Timeframe. Here the duration of my operation will be from 4 hours to 2 or 3 days. (Deadline that I set myself on this horizon of the forecast)
I would like to make sure on Daily TF that during this period of time, (that is to say over the next 2 to 5 days, including then my 3 days max on H4 TF) the trend will remain bullish, despite a decline towards the MA.
For this, I have a 20-days MA and a 7-days MA. In manual trading, the projection is visual. I want to check and will only take a position only if, during the coming days, the added closes (therefore anticipation, this is a bit in the future) are systematically greater than the close  and following 7, 6, and close  and following 20, 19, 18. (Otherwise we can do the analysis with the current close) The close can be estimated by using the other indicators (or the previous close, or the current close)
If this is verified over at least 3 days, ie that the closes and the 7-days average have ended their decline on the 20-days MA which has remained bullish; then on H4 TF I will take a position when the average 28 hours (4 hours x 7) has crossed the average 80 hours (= 4 hours x 20). Or, better, I’ll use the STO, confirmed by MACD.
In fact, The problem is, in Daily TF, to code thess formulas for the 7-days MA and also the 20-days MA: (MAshort, MAlong)
MAsh  = MAsh  + ((close-close ) / 7).
And for the MA 20 :
MAlg  = MAlg  + ((close-close ) / 20)
If I assume that the ratio ((close-close ) / 7), (= Δ) (Delta)
(The MA of the following period (MA ) is equal to the MA  of the previous period to which we add delta, given that for a MA with 7 periods, to MA of the following period will be added the 8th close and withdraw the 1st close)
Delta means that at the withdrawn close we subtract the added close and divide this difference by the period of the MA.
As long as delta is> 0 and increasing in absolute value, the MA7 will progress; if delta is<0 and increasing in absolute value, the MA7 will decrease.
But above all, this analysis allows me to anticipate a crossing or a non-crossing or tightening of MAs. So, I have to make sure that over at least 3 days of my trade the trend on the upper TF will be bullish.
THANK YOU TO TAKE A LOOK AT THIS.
I 'll tell about the second exemple in the future, after this... And I'm going to present tomorrow or after tomorrow the code I've tried to make up...
In your second example « probality Cone » I’ve seen that it is an anticipation. Can you explain this strategy please and the role of the cone ? This will undoubtedly help in a better understanding.
THANKS AND BEST REGARDS
GENTRY.08/25/2020 at 4:22 PM #142535
will it be possible to make a table of datas from all the stocks in a index and store them in an (or multiple) arrays to work with them in EXCEL ™ ?
I would like for example for each value of the CAC 40 to get the value on the 24/02/2020 and compare its value on 15/03/2020 to see which values are ahead both market and which one are late.
For now we can only have a graphic comparison with another value but we have to load each graphic one by one… which take quite a long time…
Proscreener returns only one column and 100 value max which is not enough for large markets (S & P = 500 values to store)
The solution will to scan all the values, get what we’re looking for (Open, close, range, Moving average, standard error…) and store them in an array. When all the values are stored in the array saving it to work with excel or another spreadsheet. Do you think that array var will go that far ??
Lorenzo1508/25/2020 at 4:58 PM #14254109/18/2020 at 1:47 PM #144665
below two version of same code, on with and the other wo arrays.
The second one doesn’t draw the text as expected. Any idea ?
Thks.12345678910A = averagetruerange(close)*0.1B = high<highif B thenDRAWTEXT("DW", barindex,high+ 2* A,SansSerif,Bold,10) COLOURED(204,0,204)EndifRETURN
above working ok.
Below not working123456789$A = averagetruerange(close)*0.1$B = high<highif $B thenDRAWTEXT("DW", barindex,high+ 2* $A,SansSerif,Bold,10) COLOURED(204,0,204)EndifRETURN09/18/2020 at 1:49 PM #14466609/18/2020 at 2:02 PM #14467009/30/2020 at 3:04 PM #145978
I’m not sure if this falls within the scope of arrays, but…
the idea is to draw vertical lines at different times of the past trading session.
I populate manually the array with Times ; each value of the array will bring a vertical line on the graph.
When the indicator runs, if any value within the array matches the Time of the bar, a vertical line is drawn.
The code below doesn’t work, but might give you an idea of what I’m looking for.
The graph shows what the result is expected to be.
Thanks for your assistancearray populated with Times12345678910111213// I populate manually the array with Times (...up to 200 values)$x =133208$x =133333// etc.// ..then use the values of the array to draw vertical lines at those specified Timesfor i = 0 to 1 //(in fact the number of values -1)if $x[i] = time[barindex] thendrawvline(barindex) coloured(255,0,0,255)endifnextreturn
You must be logged in to access attached files.09/30/2020 at 4:31 PM #145985
On each candle the loop will fetch into the array to know if the current time of the candle is present or not:12345678910111213// I populate manually the array with Times (...up to 200 values)$x =172911$x =172700// etc.// ..then use the values of the array to draw vertical lines at those specified Timesfor i = 0 to 1 //(in fact the number of values -1)if $x[i] = opentime then //or timedrawvline(barindex) coloured(255,0,0,255)endifnextreturn09/30/2020 at 4:53 PM #14598610/20/2020 at 8:12 PM #14796110/21/2020 at 8:21 AM #147973