Fxxtrader
Pine Script Rookie
Pine Script Rookie
Posts: 22
Joined: September 6th, 2020
Location: Toronto
Contact: Twitter TradingView Profile

Re: Convert day of week and time to other timezone

kmarryat wrote:
Thu Feb 18, 2021 11:35 pm
@Fxxtrader - the time variable is based on the bar open time. try changing the source of the dayofmonth function to time_close.

Code: Select all

FirstBarOfMonth = dayofmonth(time_close) < dayofmonth(time_close)[1]

if FirstBarOfMonth
    LabelText = tostring(month(time_close),"1st Bar\nMonth ")
    LabelAbove = label.new(x=bar_index, y=na, text=LabelText, yloc=yloc.abovebar, color=color.green, textcolor=color.white, 
      style=label.style_label_down, size=size.small)
Brilliant, that fixed it.
Thanks a lot.

Return to “Pine Script Q&A”