Acta Non Verba
Acta Non Verba

Reputation: 1

Pinescript - Days of the week

I can't get the Days of the week to display on Midnight for NY time (utc-4) its only working for UTC, I set it

isMon() => dayofweek(time('D',"","America/New_York")) == dayofweek.monday and close ? 1 : 0

drawVerticalLine(offset, cond) => if cond line.new(bar_index[offset], low - LineLength, bar_index[offset], high + LineLength, color=lineColor, width=1, style=line.style_dashed)

drawVerticalLine(0, isMon())

Upvotes: 0

Views: 1806

Answers (2)

Rohit Agarwal
Rohit Agarwal

Reputation: 1368

(EDIT-1)

You can change timeframe from D to 1 and also compare the day of week 1 min ago Pinescript takes the time based on the bar open

isMon() => dayofweek(time('1',"","America/New_York")) == dayofweek.monday and dayofweek(time('1',"","America/New_York")-1) !=dayofweek(time('1',"","America/New_York")) ? 1 : 0

Here is a sample output of the line drawn on monday midnight in UTC-4 timezone

enter image description here

Upvotes: 0

sammy22
sammy22

Reputation: 40

timezone argument can only be used when a session is specified. but try this, it might work

 isMon() => dayofweek(time('D',"","America/New_York"), (utc-4)) == dayofweek.monday and close ? 1 : 0

or you just can specify the whole session from start to end.

Upvotes: 0

Related Questions