indicator · own pane · open source
ATR Volatility Ratio
Running…
Loading chart…
About
ATR Volatility Ratio — short ATR divided by long ATR. Above 1 = volatility expanding; below 1 = volatility contracting. Crosses of 1 mark regime shifts in the noise.
- Below 0.7 for many bars = coiled spring; size up on the breakout.
Source code
//@version=5
indicator("ATR Volatility Ratio", overlay=false)
shortLen = input.int(5, "Short ATR length", minval=2, maxval=50)
longLen = input.int(50, "Long ATR length", minval=10, maxval=200)
ratio = ta.atr(shortLen) / math.max(ta.atr(longLen), 0.0001)
hline(1, "Neutral", color=color.gray)
p_Vol_Ratio = plot(ratio, "Vol Ratio", color=color.orange, linewidth=2)
alertcondition(ta.crossover(ratio, 1), "Vol expanding", "ATR ratio above 1 — volatility expanding")
alertcondition(ta.crossunder(ratio, 1), "Vol contracting", "ATR ratio below 1 — volatility contracting")
No comments yet.
Sign in to comment.