Standard deviation
All indicators

LibraryVolatility

Indicator

Standard deviation

How widely the price spreads around its own average over the length, in price units. It is the volatility measure inside Bollinger Bands.

VolatilityOwn pane2 inputsStdDev

How it is calculated

The population standard deviation of the source over the last length bars: the mean first, then the square root of the average squared distance from it, dividing by n and not n minus 1. It is computed in two passes, so a flat window can give a rounding residue near 1e-16 rather than exactly 0. As TA-Lib STDDEV with nbdev 1.

Reference: TA-Lib STDDEV

How to read it

Rising values mean price is straying further from its average, falling values a calmer market. Like ATR it is in price units and shows no direction. It reads one price per bar, so with the default close a bar's high and low play no part.

In a strategy

Derive distances or sizes from volatility, for example a stop 1.5 times ctx.ind("stddev", length=20) away from the entry, or a filter that skips trades while it is below its own average.

Inputs

InputTypeDefaultRange or choices
LengthlengthWhole number20min 2, max 5000
SourcesourcePrice"close"close, open, high, low, hl2, hlc3, ohlc4, hlcc4

What it draws

LineDrawn as
StdDevLine

Used in

No strategy template reads it yet.

OrionQuant