Indicators

Statistical Indicators

Rolling standard deviation, variance, beta, and correlation -- per-candle statistical measures applied to price windows.

What are Statistical Indicators?

Statistical indicators apply standard statistical formulas -- standard deviation, variance, correlation, beta -- to a rolling window of price data. They produce one value per candle, telling you the statistical measure at that point in time based on the most recent N candles.

Rolling vs portfolio-level
These indicators calculate statistics on a rolling basis -- candle by candle, using a lookback window. This is different from the portfolio-level metrics in your backtest results (like Beta or Volatility), which are single summary values for the entire backtest period. The statistical indicators show how these measures change over time.

The Indicators

STDDEV (Rolling Standard Deviation)

The standard deviation of the closing price over the last N candles. Standard deviation measures how spread out the prices are from their average -- a higher value means the prices varied more widely within the window, which indicates higher volatility.

STDDEV is the building block behind Bollinger Bands. The upper and lower bands are placed at a multiple of STDDEV above and below the SMA. When STDDEV is low, the bands squeeze together. When STDDEV is high, they expand. You can add STDDEV to a separate panel to see this volatility measure directly as a line chart.

VAR (Rolling Variance)

Variance is the square of the standard deviation. If STDDEV is 2.0, then VAR is 4.0. Variance is used internally by many statistical formulas but is harder to interpret directly because it is in squared units. Most traders use STDDEV instead because it is in the same units as the price.

When would I use VAR instead of STDDEV?
In practice, almost never as a standalone chart indicator. VAR exists for completeness and for use in custom calculations. STDDEV conveys the same information in more intuitive units.

BETA (Rolling Beta)

Measures how sensitive the asset's price changes are to a benchmark's price changes over a rolling window. A rolling beta of 1.5 at a given candle means that over the last N candles, the asset moved 1.5x as much as the benchmark on average. A negative rolling beta means the asset moved in the opposite direction from the benchmark during that window.

Rolling beta requires a second input series (the benchmark). For a deeper explanation of what beta measures and how to interpret it, see the Beta metric article. The difference here is that the indicator version shows beta changing candle by candle, rather than a single value for the entire backtest.

CORREL (Rolling Correlation)

The Pearson correlation coefficient between two price series over a rolling window, ranging from -1 to +1. A value near +1 means the two series moved in the same direction over the last N candles. A value near -1 means they moved in opposite directions. A value near 0 means their movements were unrelated.

Like BETA, CORREL requires a second input series. The difference: correlation measures the direction of the relationship (do they move together or apart?), while beta measures the magnitude (by how much does the asset move relative to the benchmark?). Two assets can be highly correlated (they move in the same direction) but have very different betas (one moves twice as far as the other).

Reference Table

IndicatorOutputRangeParameters
STDDEVStandard deviation (price units)0 to unboundedperiod (5), nb dev (1.0)
VARVariance (squared price units)0 to unboundedperiod (5), nb dev (1.0)
BETABeta coefficientunboundedperiod (5)
CORRELCorrelation coefficient-1 to +1period (30)

Common Mistakes

Confusing rolling indicators with backtest metrics

The rolling BETA indicator on your chart and the Beta value in your backtest results measure the same concept but over different time horizons. The indicator gives you a beta for each candle based on a short rolling window. The backtest metric gives you a single beta for the entire test period. They will not match -- the rolling value fluctuates while the summary value is a single number.

Using too short a window

Statistical measures need enough data points to be meaningful. A 5-candle standard deviation is based on only 5 data points -- a single unusual candle can dramatically change the result. Longer windows (20-30 candles) produce more stable readings but react more slowly to changes. There is no universal "right" period -- it depends on the timeframe and what you are trying to measure.

Reading too much into correlation

A high rolling correlation between two assets over the last 30 candles does not mean they will continue to move together. Correlations shift as market conditions change. Two assets that were highly correlated during a bull market may become uncorrelated or negatively correlated during a crisis.

Where to Go Next

Bollinger Bands -- uses STDDEV to create adaptive volatility bands on the price chart.

Beta (Metric) -- the portfolio-level beta in your backtest results, with worked examples and interpretation guide.

Volatility (Metric) -- the annualized portfolio volatility in your results, calculated from standard deviation of returns.

Volatility Indicators -- ATR and Bollinger Bands for measuring volatility in different ways.