0

I have noted that the timestamp on my chart bars is off by 5 hours and 40 minutes. I can't understand why. At first I thought that it was a GMT issue, as I am in GMT+8, and thought that maybe the timestamp was UTC. But then I saw that the timestamp was not 8 hours difference, but 5 hrs and 40 min. ????

The timestamp is being generated by this code:

indicator("GT Pivot Time", overlay=true)
myoffset = input(title="Offset?", defval=100)

ph = ta.pivothigh(myoffset, myoffset)
pl = ta.pivotlow(myoffset, myoffset)


drawLabel(_offset, _pivot, _style, _color) =>

    theTime = na(pl) ? str.tostring(ph) + "\n" + str.format_time(time, 'M/d') + "\n" + str.format_time(time, 'H:mm') : str.tostring(pl) + "\n" + str.format_time(time, 'M/d') + "\n" + str.format_time(time, 'H:mm') 
    if _pivot
        label.new(bar_index[_offset], _pivot, theTime, style=_style, color=_color, textcolor=color.white, size=size.small)

drawLabel(myoffset, ph, label.style_label_down, color.new(color.navy,10))
drawLabel(myoffset, pl, label.style_label_up, color.new(color.red,10))  

Even weirder, is when I tried adding 'GMT+8' to the str.format.time code, the formatted time changed not by 8 hours, as expected, but 10 hours! - still off by a wide margin

Any thoughts?

James
  • 1
  • 1

0 Answers0