For a watchlist column, I want to get the highest and lowest candle in the current day (5min chart) without considering the current candle that is being drawn.
I have this code:
But for some reason it sometimes shows the correct candle but sometimes it doesn't, I can't understand why.
Can someone help out?
Note: as far as I know, I cannot reference a higher timeframe in a watchlist column, otherwise it would be easy I think by doing highest = high(period = "day");
Thanks
I have this code:
Code:
def day = GetDay();
def h = if day != day[1]
then high
else if day[1] != day[2] or high[1] > h[2]
then high[1]
else h[2];
def l = if day != day[1]
then low
else if day[1] != day[2] or low[1] < l[2]
then low[1]
else l[2];
addLabel(1, h);
addLabel(1, l);
But for some reason it sometimes shows the correct candle but sometimes it doesn't, I can't understand why.
Can someone help out?
Note: as far as I know, I cannot reference a higher timeframe in a watchlist column, otherwise it would be easy I think by doing highest = high(period = "day");
Thanks
Last edited: