Hello Forum Members,
I would like to draw a horizontal line at the open of the 08:00 candle from the previous day, using an M5 timeframe.
I can see that this might be done by counting back bars from the current time, but I suspect that there’s probably a more elegant solution.
Can anyone suggest how this can be done?
Thank You
Could you test this code? I think it should works.
defparam drawonlastbaronly=true
if opentime=080000 then
value=close
endif
if intradaybarindex=0 then
drawhline(value)
endif
return
Thanks for the quick reply.
Unfortunately this code doesn’t draw a line for me.
Change line 7 as follows
if intradaybarindex>=0 then
Actually you can remove both line 7 and 9.
That’s an improvement.
I get a line now, but at Today’s 08:00, rather than yesterdays.
Write line 4 as
value=close[288]
because there are 24 * 12 5-minute bars in a day your are going to get yesterday’s value.
Perfect,
Thank you Nicolas and Roberto.