Hi try to understand what's going on there i just made a indicator that display a vertical bar every 4 hours
if hour % 4 == 0 and minute == 0 and second == 0
line.new(bar_index, close, bar_index, close * 1.01, extend = extend.both, color = h4_bar_color)
the problem is, it does display every 4 hour BUT it depends on the pair/timezone i'm looking for...
i'm looking at NQ1! at UTC-4 the bars are like 1 - 5 - 9 - 13 ...
when i switch to other thing e.g "BTC/USDT" (UTC-4) it have the good times at 0 - 4 - 8 - 12 ...
TO debug, i plot hour
and hour(time, syminfo.timzeone)
and for NQ it log 20 when i'm at 21h ! very confusing
As far i know hour
return the hour of the current timezone of the chart. so i dont get how timezone change or even pair change affects the display of my vertical bar !
I tried to look on different pairs and it seems that the "bug" occur on most of "futures" but i cant generalise.
thanks
hour(time, syminfo.timzeone)
provides the time zone of the exchange where the instrument is traded. For NQ futures this is Central Standard Time (CST), current offset UTC/GMT -5 hours. For BTC it depends on the exchange you choose.
You can change hour
to hour(time, "UTC-4")
according to your time zone and it should work as desired.
For a reference, please read Pine Script: Time, especially bullet points 1 and 2