How to make a custom indicator that displays the highest daily close of x days on an intraday chart? For example highest close of last 52 days on an hourly chart?
I’ve tried this and it doesn’t work:
DailyClose=DCLOSE(1)
Upper = HIGHEST[52](DailyClose)
Lower = LOWEST[52](DailyClose)
RETURN upper AS”High”, lower AS”Low”
Thanks.
Always use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read. Tahnk you 🙂
Your code will find the highest value within the last 52 1-hour bars (just a bit more than a couple of days).
If you have version 11 you can use the MTF (Multi Time Frame) support:
Timeframe(1 Day)
Upper = highest[52](close)
Lower = lowest[52](close]
Timeframe(default)
RETURN upper AS”High”, lower AS”Low”
if you have version 10.3…. you can’t, unless you use an iteration.