ITMScript
Read the daily ATR on an intraday chart
Draw a range around the last daily close from the daily average true range, on an intraday chart.
Draw a range around the last daily close, sized by the daily ATR, on a chart of shorter bars.
//@itmscript 2
study("Daily range", overlay=true)
len = input.int(14, "ATR length", min=2, max=100)
mult = input.float(1, "Range multiple", min=0.1, max=5, step=0.1)
daily = series(timeframe="1d")
reach = mult * ta.atr(len, daily)
base = close@1d
plot(base, "Last daily close", color=color.gray, width=1, style=stepline)
plot(base + reach, "Upper", color=color.green, width=1, style=stepline)
plot(base - reach, "Lower", color=color.red, width=1, style=stepline)What you see
Three stepped lines are drawn over the candles. The grey line is the close of the last finished day. A green line sits above it and a red line sits below it, each at the daily ATR times the multiple.
The lines change once a day, when a day finishes. Today's forming day is never read. Use this on an intraday chart, where a day is a coarser bar.
Change these inputs
- ATR length. The number of days in the average true range, from 2 to 100.
- Range multiple. The distance of the green and red lines from the close, in multiples of the daily ATR. From 0.1 to 5.