Docs

ta.realizedvol

Measure annualised volatility from the spread of recent log returns.

itm
ta.realizedvol(source, length, periodsPerYear)

Annualised realised volatility: ta.stdev(ta.logret(source, 1), length) * sqrt(periodsPerYear), the population standard deviation of one-bar log returns, with no mean subtracted beyond the window's own. periodsPerYear is a const you declare. It is never inferred from timeframe, because the timeframe token is an identity tag on the bars and not a claim about trading time. A fraction, not a percentage: 0.24 is 24% annualised.

Parameters

A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.

NameKindTypeDefaultRangeDescription
sourceSeriesnumber--The series to read.
lengthConstantnumber201 to 10000Window in observed bars.
periodsPerYearConstantnumber2521 to 31536000How many bars of this series make a year. 252 trading days, 52 weeks, 12 months.

Output

NameType
valuenumber

Warm-up and missing values

Warm-up
length + 1 bars. Names in the warm-up are this operator’s parameters.
Missing values
Returns na until length + 1 consecutive non-na, strictly positive observations have been seen (the first log return needs two bars, then the window needs length of them). An na or a non-positive observation resets the accumulation.

Example

itm
ta.realizedvol(close, 20, 252)
itm
plot(ta.realizedvol(close, 20, 252), "Realised volatility")