array variables availability in ProRealTime – examples and discussions
Forums › ProRealTime English forum › ProBuilder support › array variables availability in ProRealTime – examples and discussions
 This topic has 104 replies, 6 voices, and was last updated 1 month ago by Nicolas.


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!
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.
DEAR NICOLAS,
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 20days MA and a 7days 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 [8] and following 7, 6, and close [21] 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 7days average have ended their decline on the 20days 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 7days MA and also the 20days MA: (MAshort, MAlong)
MAsh [2] = MAsh [3] + ((closeclose [8]) / 7).
And for the MA 20 :
MAlg [2] = MAlg [3] + ((closeclose [21]) / 20)
If I assume that the ratio ((closeclose [8]) / 7), (= Δ) (Delta)
(The MA of the following period (MA [2]) is equal to the MA [3] 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 noncrossing 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.
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 ??
Best Regards
Lorenzo15
Hi,
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[14](close)*0.1B = high[0]<high[1]if B thenDRAWTEXT("DW", barindex,high[1]+ 2* A,SansSerif,Bold,10) COLOURED(204,0,204)EndifRETURNabove working ok.
Below not working
123456789$A[0] = averagetruerange[14](close)*0.1$B[0] = high[0]<high[1]if $B[0] thenDRAWTEXT("DW", barindex,high[1]+ 2* $A[0],SansSerif,Bold,10) COLOURED(204,0,204)EndifRETURNHello,
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 assistance
array populated with Times12345678910111213// I populate manually the array with Times (...up to 200 values)$x[0] =133208$x[1] =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.
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[0] =172911$x[1] =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)endifnextreturnJust a single question, please: arrays are supported for backtesting? (involving some indicator using them) Thanks.

AuthorPosts