TradingView volatility comparisons

ATR vs standard deviation: choose the input and units first

ATR measures smoothed true range in price units, including movement relative to the previous close. Standard deviation measures dispersion around the mean of a chosen series. Applied to closes, it is also in price units; applied to returns, it measures return dispersion. Use ATR when defining a range-based stop distance, price standard deviation for dispersion around a price average, and return standard deviation for a return-risk comparison. None determines the next price direction.

See the decision guide

Three calculations often called volatility

Specify the input before comparing indicator values. TradingView documents RMA as the default ATR smoothing, with other smoothing choices available. Standard deviation requires a separate choice of series and denominator: population variance divides squared deviations by N, while sample variance divides by N − 1.

  • The averaging operation differs. ATR averages nonnegative ranges; standard deviation squares centered observations before averaging and taking a square root. Equal lookback lengths do not make the outputs equivalent.
  • Use the same symbol, session, price adjustments, chart interval, and completed bars. A daily ATR and a five-minute return standard deviation describe different sampling intervals.
MeasureInput and calculationUnits and use
ATRSmooth max(high − low, |high − previous close|, |low − previous close|).Price units; scale a range-based distance.
Close-price standard deviationSquare root of the average squared distance of closes from their window mean.Price units; describe dispersion around a price average.
Return standard deviationApply the same dispersion calculation to simple or log returns, with the return definition stated.Dimensionless; display as a percentage for a specified return interval.

Calculate both from one OHLC sample

All prices below are hypothetical dollars. Bar 0 supplies only a previous close of 100. Evaluate bars 1 through 3, giving three true ranges, three closes, and three simple returns. Initialize the three-period ATR at bar 3 as the mean of those first three true ranges. This explicit seed makes the example reproducible; an indicator with earlier history can have a different RMA value.

  • At bar 2, the high-low range is 108 − 105 = 3, but the previous close is 101. True range is max(3, 7, 4) = 7. The opening gap contributes to the distance from the previous close even though the bar itself spans only $3.
  • ATR(3) at the declared seed is (3 + 7 + 4) / 3 = $4.666667. The close mean is (101 + 107 + 105) / 3 = $104.333333. Squared close deviations sum to 18.666667, so population standard deviation is sqrt(18.666667 / 3) = $2.494438. The sample version is sqrt(18.666667 / 2) = $3.055050.
  • Simple return is current close / previous close − 1. The three exact returns are 1/100, 6/101, and −2/107. Their mean is 1.690478%; population standard deviation is 3.225485%, and sample standard deviation is 3.950396%. Calculate from the exact fractions rather than the rounded table.
  • If bar 4 has open 105, high 106, low 103, and close 104, its true range is 3. The RMA update is (2 × 4.666667 + 3) / 3 = $4.111111 using full precision. A three-bar SMA of true range instead gives (7 + 4 + 3) / 3 = $4.666667. Record smoothing as well as length.
BarOpenHighLowCloseTrue rangeSimple return
11001029910131.000000%
210610810510775.940594%
31071081041054−1.869159%

Gaps, reversals, and trend drift produce different readings

Standard deviation does not automatically ignore gaps. In the sample, the move from close 101 to close 107 enters both the close-price dispersion and the return calculation. What a close-only series omits is the path between closes. ATR uses the high and low as well, but still cannot reconstruct the order of intrabar prices or count every price swing.

  • In the constant-dollar trend example, a ten-close window from 100 through 109 has population standard deviation sqrt(8.25), about $2.8723. A larger reading can therefore reflect a longer trend window, without any increase in the assumed $2 true range.
  • Zero dispersion of past returns does not imply zero future risk. A gap, regime change, or execution failure can occur after that sample. Both calculations describe observed data, not guaranteed future outcomes.
Constructed caseATR or true-range behaviorStandard-deviation behavior
Previous close 100; open 110, high 112, low 99, close 100True range is 13. Repeating such bars keeps a seeded ATR positive.If all closes remain 100, close and return standard deviations are zero despite the intrabar movement.
Closes 100, 101, 102, 103, 104, with a constant $2 true range per barA seeded ATR stays at $2.Population standard deviation of these five closes is sqrt(2), about $1.4142, because the price levels drift.
Positive closes rise exactly 1% per barDollar ranges can grow as the price level grows.Simple returns are all 1%, so their standard deviation is zero while close-price standard deviation is positive.

Keep stop distances separate from return-risk estimates

Assume a hypothetical long entry at $105 after bar 3 and freeze the seeded ATR of $4.666667 at entry. A two-ATR distance is $9.333333, producing an unrounded stop level of $95.666667. This is a rule specification, not a recommended multiplier. A trailing rule that updates ATR and the reference price would produce a different order path.

  • For an unlevered share position with $500 of planned price risk and no costs, floor(500 / 9.333333) = 53 shares. The unrounded planned loss is $494.67. Actual sizing must account for tick rounding, commissions, slippage, available capital, and any currency or contract-value conversion.
  • A stop is not a maximum-loss guarantee. A gap through the stop or insufficient liquidity can produce a worse fill. Multiplying ATR by two does not establish a 95% probability range.
  • The sample return standard deviation of 3.950396% describes variation of one-bar simple returns around their mean. It is not directly subtractable from a dollar price. Converting a return scale to dollars requires an explicit price reference and model; it still does not guarantee a stop-fill outcome.
  • At bar 3, 100 × ATR / close = 4.444444%. This normalized ATR can support relative range comparisons when definitions match. Its percentage units do not make it equal to the 3.225485% population return standard deviation.
  • Multiplying every OHLC price by ten multiplies ATR and close-price standard deviation by ten, while simple-return standard deviation is unchanged. For return-risk comparisons across assets, align the return interval, dates, estimator, and adjustments. Annualization adds assumptions about time scaling; it does not make a three-bar sample reliable.

Make the TradingView comparison reproducible

Use ordinary price candles and record the exchange symbol, chart timeframe, regular or extended session, and adjustment settings. Add ATR and record its length and smoothing. For a standard-deviation study, inspect whether its source is close, price change, simple return, or log return, and whether it uses N or N − 1. A label saying volatility is not enough to establish the formula.

  • Use closed bars and sufficient preceding history. RMA retains a decaying contribution from older ranges; a fresh seed and a mature chart can disagree even when the visible last three bars match.
  • Keep dollar and percentage outputs in separate panes or explicitly labelled table columns. Compare calculations first, then test any complete entry, exit, and sizing rule with execution costs.
  • A sample standard deviation needs at least two observations. Three returns need four closes. Do not replace missing observations with zero; define whether the calculation waits, skips, or reports unavailable data.
  • Simple returns are undefined when the previous close is zero. Log returns require positive adjacent closes. ATR and price standard deviation can still be calculated from finite valid OHLC data when a log-return definition is unsuitable. Review split adjustments and futures-roll construction before treating a large range as a tradable move.

Turn the selected measure into an inspectable rule

The Pine Script AI Coding Agent can draft a comparison display or strategy from the rules you specify. Supply the series, length, ATR smoothing and initialization, standard-deviation denominator, session, and missing-data behavior. For a stop rule, state whether the volatility value is frozen at entry or updated on later bars. Use the sample above as an independent arithmetic check.

  • Request a syntax check, inspect the resulting source, and compare chart readings with independently calculated values. A successful syntax check does not verify financial assumptions or profitability.
  • Describe rules you own or can inspect. This workflow does not promise access to protected scripts, account migration, or trade execution.
Where Pineify fits

Pine Script AI Coding Agent

Draft your chosen volatility calculation and stop rules, request syntax validation, and check the generated output against known values.

Draft a volatility rule

Frequently asked questions

Educational comparison, not investment advice. All prices and sizing examples are hypothetical, not market observations or backtests. Volatility estimates and stop orders do not guarantee limited losses or returns. Review generated code and execution assumptions independently.

Sources and verification

Published by Pineify. Pineify is an independent product and is not affiliated with TradingView. Sources support the technical explanations; examples do not establish trading performance.