SYSTEM NOTICE

Auto translation by AI. Be sure, accuracy, nuances and authorial intent may not be fully reflected.
見出し画像

Pine Script™ (v6) Notes - Column: When does a day on the chart begin? (About TimeZone) (6)

Recap of previous parts


Displaying clocks for multiple timezones

While I was at it, I also wrote a script to display clocks for multiple timezones.

str.format_time()By specifying "z" in the format, you can display the timezone name, making it a clock that also shows whether the US is in daylight saving time or standard time.The official reference does not explain the characters used to represent timezones, but the lowercase "z" displays the timezone.

indicator("noteClock", overlay = true)

ListOfTZ=input.text_area("America/Chicago\nAmerica/New_York\nEurope/London\nGMT+3\nAsia/Tokyo\n")

tl=str.split(ListOfTZ,"\n")
for i = 0 to tl.size()-1
    s = str.match(tl.get(i), "[\\S]+")
    if str.length(s) == 0
        tl.remove(i)

clock=table.new(position.top_right,100,100,color.new(color.black,60),color.new(color.gray,80),4)

for i=0 to tl.size()-1
    clock.cell(i,10,text=tl.get(i)+str.format_time(timenow,"\nMM/dd\nz",tl.get(i)),text_color=color.new(color.lime,20))
    clock.cell(i,20,text=str.format_time(timenow,"HH:mm",tl.get(i)),text_color=color.new(color.white,20),text_size=36,text_formatting=text.format_bold)

Displays the current time (timenow) in each timezone. (Figure 1)

Figure 1: Multiple timezone clocks

In the settings screen, you can delete unnecessary timezones from the default list or add the ones you need. Please give it a try. (Figure 2)

Figure 2

Maybe it will continue... maybe it won't...


いいなと思ったら応援しよう!

rca よろしければ応援お願いします!