Skip to content

Add RealizedVolatility indicator (Parkinson high-low estimator) - #9864

Open
rairishi764 wants to merge 1 commit into
QuantConnect:masterfrom
rairishi764:feature-9863-realized-volatility-indicator
Open

rairishi764 wants to merge 1 commit into
QuantConnect:masterfrom
rairishi764:feature-9863-realized-volatility-indicator

Conversation

@rairishi764

Copy link
Copy Markdown

What this PR adds

  • Indicators/RealizedVolatility.cs — a new indicator implementing the Parkinson (1980) high-low range estimator of realized volatility, as BarIndicator + IIndicatorWarmUpPeriodProvider, following the same shape as RogersSatchellVolatility.
  • Tests/Indicators/RealizedVolatilityTests.cs — extends CommonIndicatorTests<IBaseDataBar>, comparing against an independently-computed reference CSV (Tests/TestData/spy_with_rv.csv), following the same convention as RogersSatchellVolatilityTests/spy_with_rsv.csv.
  • Algorithm/QCAlgorithm.Indicators.cs — the RV(...) helper method, mirroring RSV(...) for RogersSatchellVolatility.
  • Tests/QuantConnect.Tests.csproj — wires up the new test fixture CSV.

What this PR does not change

  • No changes to existing indicators or the Python API surface.
  • No new external package references.

Public API surface

public class RealizedVolatility : BarIndicator, IIndicatorWarmUpPeriodProvider
{
    public int WarmUpPeriod { get; }
    public RealizedVolatility(string name, int period);
    public RealizedVolatility(int period);
}

QCAlgorithm.RV(symbol, period, resolution, selector) creates and registers it, mirroring RSV(...).

Why Parkinson, and why now

LEAN has several volatility indicators (AverageTrueRange, RogersSatchellVolatility, ImpliedVolatility, Keltner/Bollinger) but no realized volatility indicator — the standard backward-looking measure of historical price variation. Parkinson is the simplest high-low estimator (needs only High/Low, unlike Garman-Klass/Yang-Zhang which also need Open/Close), making it a clean first addition and a template for those follow-ups.

Testing

  • dotnet build clean on Common, Algorithm, and the full Tests project (net10.0).
  • RealizedVolatilityTests: 16/17 passing locally. The 1 failure (WarmUpIndicatorProducesConsistentResults) is a pre-existing Python runtime DLL gap in my local dev environment, not a regression — I confirmed the identical failure occurs when running the same test against the already-merged RogersSatchellVolatility indicator on this machine.
  • The reference CSV (spy_with_rv.csv) was generated independently in Python from the existing spy_with_rsv.csv OHLC data, not derived from my C# implementation.

Closes #9863

@rairishi764
rairishi764 force-pushed the feature-9863-realized-volatility-indicator branch from b6af91c to 9972e44 Compare October 3, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a Parkinson realized volatility indicator

1 participant