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?
Asked
Active
Viewed 91 times
0

sey eeet
- 229
- 2
- 8
-
Check [This](https://stackoverflow.com/questions/63041879/pine-script-how-to-display-current-time-in-charts-timezone-on-label-at-every) – Gu5tavo71 Feb 21 '23 at 21:46
-
that does not work for alert – sey eeet Feb 28 '23 at 01:02
1 Answers
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)

Gu5tavo71
- 706
- 1
- 4
- 11