Standard Deviation (volatility)

Standard Deviation of price over a rolling lookback window. Also known as Historical Volatility (HV). Z-Score is also returned. [Discuss] :speech_balloon:

chart for Standard Deviation (volatility)

// usage
IEnumerable<StdDevResult> results =

// usage with optional SMA of SD (shown above)
IEnumerable<StdDevResult> results =
  quotes.GetStdDev(lookbackPeriods, smaPeriods);


lookbackPeriods int - Number of periods (N) in the lookback period. Must be greater than 1 to calculate; however we suggest a larger period for statistically appropriate sample size.

smaPeriods int - Optional. Number of periods in the moving average of StdDev. Must be greater than 0, if specified.

Historical quotes requirements

You must have at least N periods of quotes to cover the warmup periods.

quotes is a collection of generic TQuote historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.




Date DateTime - Date from evaluated TQuote

StdDev double - Standard Deviation of price

Mean double - Mean value of price

ZScore double - Z-Score of current price (number of standard deviations from mean)

StdDevSma double - Moving average (SMA) of StdDev based on smaPeriods periods, if specified


See Utilities and helpers for more information.


This indicator may be generated from any chain-enabled indicator or method.

// example
var results = quotes

Results can be further processed on StdDev with additional chain-enabled indicators.

// example
var results = quotes