How to code show highest and lowest bar of mondays(UTC 04.00 monday to tuesday ) indicator in pinescript , is that possible ?
I've created high and low levels of day but I've couldn't set for monday especially. Can someone solve this problem ?
You can use the dayofweek
built-in variable to figure out if it is Monday and update your variables accordingly.
//@version=5
indicator("My script", overlay=true)
is_monday = (dayofweek == dayofweek.monday)
is_new_monday = (not is_monday[1] and is_monday)
bgcolor(is_new_monday ? color.new(color.blue, 85) : na)
var float high_price = high
var float low_price = low
if (is_new_monday)
high_price := high
low_price := low
else if (is_monday)
if (high > high_price)
high_price := high
if (low < low_price)
low_price := low
plot(high_price, "Monday High", color.green, 1, plot.style_circles)
plot(low_price, "Monday Low", color.red, 1, plot.style_circles)