Arrays & Same Candle Programming
Forums › ProRealTime English forum › ProBuilder support › Arrays & Same Candle Programming
- This topic has 4 replies, 4 voices, and was last updated 6 months ago by pableitor.
-
-
05/06/2024 at 6:23 AM #232352
Hi All,
I though I would ask one last time if the below is possible in current version of ProBuilder.
If IsLastBarUpdate is true then
- store price and say average[20] value of current candle in an array variable.
Then when IsLastBarUpdate is true again then
- there is nothing to compare since array above only has 1 price and 1 average[20] value
- just store the second reading of price and second reading of average[20] value in the same array above
Then when IsLastBarUpdate is true again then
- Check price against the prices stored in array above
- if there is a match then compare the average[20] value of this reading with the average[20] value of the matched price in the array then continue storing the two new values in the array
- If there is not a price match, then just store the values in the array as usual.
Continue doing the above whilst IsLastUpdate continues to be true until close of the current Bar.
Can current version of Probuilder handle the above or not yet?
Many thanks
05/07/2024 at 9:06 PM #232444hi… see if this is getting anywhere!
druby
123456789101112131415161718192021222324252627// !!! default timeframe 1 minutetimeframe(20minute, updateonclose) // update only every 20 minutesclose20m = close // 20minute closebarIndex20m = barindex // 20minute barindextimeframe(1minute ) // 1minute timeframeclose1m = close // 1minute closeif barIndex20m <> barIndex20m[1]then // end of 20minute bar!drawvline(barindex[20])style(dottedline,1) // denote with vertical line// calculate the 20minute bar average based on last 20 1minute barsavg1m = average[20](close1m)// display this average over the relative 15minute bar widthdrawsegment(barindex,avg1m,barindex[20],avg1m)style(dottedline,2)coloured("blue")// table variablesprint(close20m[1]) // this [1] aligns up 20m close with the avg1m valueprint(avg1m) // in tableprint(barindex20m)endifreturn close20m coloured("red")as"20m Close",close1m coloured("lime")as"1m close"05/08/2024 at 3:00 PM #232481Can you make an example with some data?
In addition, what would you like to do with the array containing those data?
05/08/2024 at 11:41 PM #232504Hi Roberto,
Drubi did a good job above but unfortunately he had to use multi timeframes strategy (like a trick) which gives rise to two issues:
- I have to apply the code to the lower timeframe which is a multiple of the higher timeframe
- Perhaps Prorealcode is not ready yet or cannot handle capturing data from a current Bar directly on any timeframe once chooses.
I will try to re-explain with an example as you asked:
- Assume I am looking at a 1 hr time frame.
- I have a current Bar obviously with price (close) moving up and down during market session (or assume after 10am i.e. after market open)
- Assume also I have an indicator running (RSI, MACD, VWAP, etc…) which also registers a reading every time the current bar price moves up and down
Now given the above:
- Can prorealcode use an expression like (if islastbarupdate then) or any other expression for that matter to
- Capture both the price and the indicator reading value and store them as fixed values somewhere for later use?
- Capture the next price and indicator reading everytime the bar updates and store them next to the first readings above
- Keep on capturing and storing price and indicator readings for as long as the current bar is updating?
- The above has to be done directly to the current bar on the one timeframe itself without the need to resort to a lower timeframe as a trick to get around the issue
Whilst the code is continually storing, I just want to for example Print the data and maybe print or display the cumsum or summation of the data from open time of the Bar (say 10am) etc which should not be hard to do. The hard part is the live continual capture and storing of the data as I described above.
Tnx
05/09/2024 at 4:18 PM #232517I tried to do like you said but AFAIK theres no way to store tick data in any array or variables, much less use them to trade in higher timeframes. You just can view it if you previously declare <defparam drawonlastbaronly = true>
Please someone correct me if I am wrong.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on