Volatility
ATR Signals and Stop References: Volatility Without Direction
Use ATR to define volatility thresholds and stop-distance examples. Inspect a Pine Script reference line without confusing it with a managed stop or a forecast.
ATR Signal Interpretation
Quick-reference guide to 5 signal types you will see on the chart.
| Signal Type | Indicator Condition | Market Meaning | Interpretation limits |
|---|---|---|---|
| Illustrative upward expansion | Close exceeds the prior high plus a chosen multiple of current ATR, with ATR above its average | A precisely defined price-distance event, not an entry-price comparison. | No momentum or profitability guarantee. |
| ATR below its average | Current ATR is below its own moving average | Recent true range is lower than that reference. | Does not promise a large move next. |
| ATR crosses above its average | ATR crosses from below to above its reference | A change in measured volatility. | Does not supply trade direction. |
| Close crosses below a Chandelier-style line | Close crosses below rolling highest high minus three current ATRs | Interaction with a recalculated reference level. | The line can fall; it is not a ratcheting, position-aware stop. |
| Initial stop-distance example | A hypothetical entry minus two entry-time ATRs | A proposed distance calculation, not an implemented order. | Fix the reference ATR explicitly; gaps and slippage can exceed the intended loss. |
ATR Pine Script Signal Code
Educational indicator example. Review its exact rules and compare its plots with your intended calculation in TradingView. It does not place orders or establish profitability.
Pine Script v6
//@version=6
indicator("ATR Condition and Reference Examples", overlay=true)
atrLen = input.int(14, "ATR Length", minval=1)
multiplier = input.float(2.0, "Distance Multiplier", minval=0.1, step=0.1)
averageLen = input.int(20, "ATR Average Length", minval=1)
highLen = input.int(22, "Rolling High Length", minval=1)
atrValue = ta.atr(atrLen)
atrAverage = ta.sma(atrValue, averageLen)
reference = ta.highest(high, highLen) - 3.0 * atrValue
breakout = barstate.isconfirmed and close > high[1] + multiplier * atrValue and atrValue > atrAverage
expansionCross = ta.crossover(atrValue, atrAverage)
referenceCross = ta.crossunder(close, reference)
expansion = barstate.isconfirmed and expansionCross
referenceBreak = barstate.isconfirmed and referenceCross
plot(reference, "Rolling high minus 3 ATR reference", color=color.red)
plot(close + multiplier * atrValue, "Current close plus ATR distance", color=color.new(color.blue, 65))
plot(close - multiplier * atrValue, "Current close minus ATR distance", color=color.new(color.blue, 65))
plotshape(breakout, "Upward distance event", shape.triangleup, location.belowbar, color=color.green, size=size.small)
plotshape(expansion, "ATR above average event", shape.diamond, location.abovebar, color=color.orange, size=size.tiny)
alertcondition(breakout, "Upward distance event", "Confirmed close exceeds prior high plus selected current ATR distance")
alertcondition(expansion, "ATR crossed above average", "Confirmed ATR cross above its average; no direction implied")
alertcondition(referenceBreak, "Close crossed below reference", "Confirmed close cross below the rolling high minus 3 ATR reference")Example settings for ATR
Record the inputs used by the example. These settings are not an optimized trading recommendation.
| Parameter | Default | Description |
|---|---|---|
| ATR Length | 14, example | ta.atr uses Wilder-style smoothing of true range. The value changes as the observed ranges change. |
| Distance Multiplier | 2.0, example | Used by the price-distance event and plotted close-relative bands. It does not control the separately defined three-ATR reference. |
| ATR Average Length | 20, example | The reference for comparing current volatility; not a universal squeeze setting. |
| Rolling High Length | 22, example | The highest-high window can drop an older extreme, allowing the plotted reference to move down. No position state is maintained. |
Turn the condition into an explicit rule
Specify the calculation, confirmation time, entry and exit rules before asking Pineify to draft or revise Pine Script. Review the code and simulate realistic costs before evaluating a strategy.
Explore Pine Script codingRelated Resources
Official calculation and usage references
FAQ
ATR Signals FAQ
Does ATR predict direction or the next breakout?
No. It summarizes true range, including gaps. A low reading describes the observation window; it does not establish that a large move is imminent.
Is the plotted reference a protective stop order?
No. The indicator draws a line and alert events. A managed long stop may require a position-specific entry, a ratchet that never loosens, and an actual execution mechanism. None is implemented here.
Is ATR a fixed distance unlike Bollinger Bands?
Current ATR changes with new data. A distance is fixed only if a rule stores the entry-time ATR rather than continually recalculating it. Bollinger Bands use a different dispersion calculation.
How can I compare stop distances fairly?
Define the same entries, risk budget and execution assumptions. If distance doubles, position size usually must change to keep the planned monetary risk comparable. Include gaps, fees and slippage; a planned stop is not a loss guarantee.
Can I compare raw ATR across different assets?
Raw ATR is in price units. Normalize deliberately, for example by price, when a percentage comparison is needed, and keep timeframe and data conventions consistent.
How do I verify these alerts?
Check the named condition against the completed bar and saved inputs. The expansion and reference-cross alerts are crossing events; the upward-distance condition can be true on successive bars. Test delivery on live data, not by expecting Bar Replay to trigger server alerts.