Creating timer to capture indicator values at intervals
Forums › ProRealTime English forum › ProBuilder support › Creating timer to capture indicator values at intervals
- This topic has 13 replies, 3 voices, and was last updated 3 years ago by robertogozzi.
-
-
05/21/2021 at 8:45 AM #170093
Hello All,
I have created an indicator (intraday only) that returns a number value that gets drawn on the chart (via drawtext). The number is dynamic and continuously changes from start of timeframe to end of timeframe (say 15mins) and then freezes on bar and starts again for fresh new bar.
My question is:
- Is it possible to set up a timer (say a 15 mins timer) and then capture the running value every 1 min interval and save that value in a separate variable to then draw it on the bar?
- Is it possible to lookback across the intraday bars and locate the highest high bar and then capture the value that is shown on that bar so that I can draw it on Barindex[1] for example as an easy reminder?
Thank you in advance
05/29/2021 at 1:17 PM #170738Can you make an example?
05/29/2021 at 11:36 PM #170756Thank you Roberto. The example could be really simple. Let’s assume I have basic indicator that is simply returning the “Price” of the current live bar. The time frame is 15 mins. Obviously the “Price” will fluctuate up and down for the duration of the time frame (i.e. 15 mins) and then closes at the end of the 15th minute and a new bar opens and so on…
Now if I open a 1 min chart, I can simply observe the closing price at the end of each 1 min but I don’t want to do that.
Instead, I want to write a code and apply it to the 15mins chart that does exactly what the 1 min chart does, i.e. capture the price of the bar at the end of each minute (therefore will capture 15 price values) and then DRAWTEXT each value on the chart.
Should be simple with dynamic array variable I think 🙂
Thanks
05/30/2021 at 8:55 AM #170766G_CFD_Trader – Please follow the forum rules. I have deleted your double post in another topic… and the reply that I wasted time giving to it. Here is the forum rule:
- Do not double post. Ask your question only once and only in one forum. All double posts will be deleted anyway so posting the same question multiple times will just be wasting your own time and will not get you an answer any quicker. Double posting just creates confusion in the forums.
05/30/2021 at 9:22 AM #170767Not a problem my friend. Please accept my apology.
My regards,
Walid
05/30/2021 at 9:58 AM #170775There you go:
123456Timeframe(15 minute,UpdateOnClose)Close15 = close//Timeframe(default)DrawText(“#Close15#”,BarIndex,high+range,SansSerif,Bold,16) coloured(0,128,0,155)Return05/30/2021 at 10:11 AM #170776I forgot to add this very first line:
1Defparam DrawOnLastBarOnly = trueShould you want the text plotted at its actual position, just replace high+range with Close15.
05/30/2021 at 1:11 PM #170781thanks Roberto but I think the code you have suggested above will draw on the chart only 1 value (the close at the end of the 15th minute). I don’t want that.
I want it to draw 15 closes (1 close every 1 minute)
05/30/2021 at 1:31 PM #170784To draw the close every one minute you don’t need any TF other the 1-minute:
123456MyClose = close////DrawText(“#MyClose#”,BarIndex,high+range,SansSerif,Bold,16) coloured(0,128,0,155) //every tick//DrawText(“#MyClose[1]#”,BarIndex,high+range,SansSerif,Bold,16) coloured(0,128,0,155) //when the candle closesReturn05/30/2021 at 1:44 PM #170789I need to draw the close every one minute on a 15 min chart?
05/30/2021 at 1:54 PM #170792As I previously mentioned, “close” is just an example. In reality I have an indicator that returning a live dynamic number that is changing continuously from bar open through to bar close (therefore similar to Close so that’s why I gave Close as example).
So I need to capture the closing value of my indicator every 1 minute that elapses and draw it on chart (so in total I need to capture and draw 15 readings, minute1, minute2, minute 3………minute 15)
05/30/2021 at 2:05 PM #170794You cannot draw every minute on the 15-minute chart.
You can use the above code, choosing the line that suits you best, every tick or after closing.
05/30/2021 at 2:17 PM #170796Isn’t it possible with dynamic array? Define a dynamic array that can store 15 values (1 value every 1 minute). Then convert the array variables back to standard variables in order to draw each value on the chart. Not possible?
05/30/2021 at 2:45 PM #170798 -
AuthorPosts
Find exclusive trading pro-tools on