0

The title says it all. I want to use alertcondition and provide current_time={{timenow}} for it. but the time that is shown is not the NY time, in my system and chart I do have NY time though. Is there a way to make {{timenow}} to show the NY time?

sey eeet
  • 229
  • 2
  • 8

1 Answers1

0

The answer is in this post

As explained here,

Pine scripts have no visibility on the chart's timezone you may have selected manually. That only affects the display of the chart.

The interesting thing is that there is a @PineCoders framework that converts 'Time Exchage to Time Chart'

With hour and minute, allows you to set the return value to a specified time zone (NY time in your case)

On the other hand, you cannot use an argument of type 'series string' in alertcondition. You must use alert

Something like that:

i_timeZone   = input('GMT-5')//NY Time
current_time = str.tostring(hour(timenow, i_timeZone), '00:') + str.tostring(minute(timenow, i_timeZone), '00:') + str.tostring(second(timenow, i_timeZone), '00')

if yourConditionLongShort
    alert(current_time, alert.freq_once_per_bar)

enter image description here

Gu5tavo71
  • 706
  • 1
  • 4
  • 11