What it measures

Standard deviation measures how far prices in a window typically sit from their average. It is the volatility number inside Bollinger Bands, inside every z-score strategy, and inside most "statistical" rules in the screened universe. Mean deviation, used by the CCI, is its simpler cousin: the average absolute distance instead of the root mean square.

The calculation

variance = Σ (price i − mean)² / n, over the last n bars standard deviation = √variance

Pine's ta.stdev divides by n (the population formula); a spreadsheet's default divides by n − 1. The difference is small at 20 bars and matters when someone compares numbers across tools.

Inputs and defaults

  • Length: 20 in Bollinger Bands; whatever the rule needs elsewhere.
  • Source: close for most rules; returns for anyone doing it the statistician's way.

How it is read

As a volatility level, and as the unit of a z-score: (price − mean) / standard deviation tells you how unusual the current price is relative to its recent window. A z-score of 2 is the upper Bollinger Band.

Where it fails

Computed on price rather than returns, it rises in any trend simply because prices are spreading away from a lagging mean; a trending market looks "volatile" even when its bar-to-bar changes are small. A z-score built on it then reads every trend as an anomaly that should revert. Computed on returns it is a cleaner volatility measure, and almost no community strategy does that.

How the desk reads it

The desk reads any z-score strategy as a reversion rule and asks what it did in the year the market did not revert. A deviation computed on price rather than returns is read as a trend detector that thinks it is a volatility measure.

In the desk's screen

Of the 614 screened strategies in the library, 110 (17.9%) use this indicator somewhere in their logic.

42 of those were gross-profitable on enough cells to reach the after-fee replay.

The count is read from the compiled code of each strategy in the library; a strategy that computes the indicator by hand under another name is not counted. The desk's own rules are not part of the count.