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 254 replies, 50 voices, and was last updated 1 month ago by robertogozzi.
-
-
03/03/2020 at 8:31 AM #12102703/03/2020 at 9:25 AM #121029
I don’t think it is available presently for that type of account, but very soon. Best way to verify is by typing one of the array instruction (or by copy/paste one of the examples of that topic) and check if there is a syntax error 😉
03/03/2020 at 5:14 PM #121087I created a little code that uses arrays to create a seasonality curve. It might be of interest to anyone reading this topic so here is the link to that indicator:
https://www.prorealcode.com/topic/seasonality-curve-using-arrays/
03/04/2020 at 9:21 AM #121118Another example posted by Roberto, the Meander Bands updated with ARRAYS
03/06/2020 at 1:59 PM #121355Example with a price gap levels indicator coded by @grivoire
03/13/2020 at 9:30 AM #122026Example #7: calculate the Average Daily Range (ADR)
A simple example on how to store a value in an array while the history is loaded. Each new day, the $drange variable increase its index to save the previous day range (High-Low). Once the array length is sufficient (has enough values) to calculate the average period, the calculation is made. Therefore, we only use a quick loop through the array and not through the global data history to fetch the last X days range to calculate the ADR.
1234567891011121314151617181920// https://www.prorealcode.com/topic/array-variables-availability-in-prorealtime/// (please do not remove the link above for future reference)// Example #7: Average Daily Range//--- settingsadrperiod = 20//--- end of settingssum = 0if day<>day[1] then$drange[lastset($drange)+1]=dhigh(1)-dlow(1)if lastset($drange)>=adrperiod thenfor i = lastset($drange) downto lastset($drange)-adrperiod dosum = sum+$drange[i]nextadr = sum/adrperiodendifendifreturn adr as "Average Daily Range"03/13/2020 at 5:22 PM #122079Thanks Nicolas.
1 user thanked author for this post.
03/24/2020 at 4:33 PM #123165Hi Nicolas,
I’ve a question for the expert.
Is it possible with the new array function (or without) to calculate live price projection targets in the chart with the corresponding probability?
And if so, would it be possible to create a template in which we enter our conditions?Thank you.
Fabian
03/24/2020 at 5:11 PM #12317203/26/2020 at 2:01 PM #123419I developed my seasonality curve indicator that uses arrays further and it might be of interest for anyone studying the use of arrays.
Find it here:
https://www.prorealcode.com/topic/seasonality-curve-using-arrays/#post-123417
03/29/2020 at 3:02 PM #123815Are arrays only used for data? ie external to the code. Or could they somehow be used to select indicator variables within the code? I’m thinking of something like this
1234567891011121314//PRC_Stochastic RSI | indicatorlengthRSI = lr //RSI periodlengthStoch = ls //Stochastic periodsmoothK = sk //Smooth signal of stochastic RSIsmoothD = sd //Smooth signal of smoothed stochastic RSImyRSI = RSI[lengthRSI](close)MinRSI = lowest[lengthStoch](myrsi)MaxRSI = highest[lengthStoch](myrsi)StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI)K = average[smoothK](stochrsi)*100D = average[smoothD](K)c1 = K>Dc2 = K<Dwhere the 4 variables result in hundreds or thousands of workable combinations.
03/29/2020 at 5:46 PM #123834You can store any value you like in an array. So you could say recognise a set of candle price action on the chart and then store all the periods of an indicator that were within a certain range at this time.
For example you could have an array with storage locations from 1 to 200 and when price does something you like add one to each location if the price was above that period average. So for example:
1234567if (my event happens) thenfor a = 2 to 200if close > average[a] then$avg[a] = $avg[a] + 1endifnextendifSo now we have a store of which averages were correct the most often.
1 user thanked author for this post.
03/29/2020 at 6:51 PM #123837Thanks Vonasi, it seems a hugely powerful tool. I’ll have to do some serious homework to get my head around it.
03/30/2020 at 8:35 AM #12387303/30/2020 at 9:36 AM #123889If the variables are dynamic, is it self-optimizing? In the StochasticRSI example, if each variable had an array of 2-20 would the code then select the most effective combination? Or is it recording what would have been the best combination for future reference?
-
AuthorPosts
Find exclusive trading pro-tools on