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
Thank 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
G_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.
Not a problem my friend. Please accept my apology.
My regards,
Walid
There you go:
Timeframe(15 minute,UpdateOnClose)
Close15 = close
//
Timeframe(default)
DrawText(“#Close15#”,BarIndex,high+range,SansSerif,Bold,16) coloured(0,128,0,155)
Return
I forgot to add this very first line:
Defparam DrawOnLastBarOnly = true
Should you want the text plotted at its actual position, just replace high+range with Close15.
thanks 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)
To draw the close every one minute you don’t need any TF other the 1-minute:
MyClose = 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 closes
Return
I need to draw the close every one minute on a 15 min chart?
As 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)
You 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.
Isn’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?