Skip to content

Add WaveTrend Oscillator indicator#9423

Closed
AlexCatarino wants to merge 1 commit intoQuantConnect:masterfrom
AlexCatarino:feature-6411-wavetrend-oscillator
Closed

Add WaveTrend Oscillator indicator#9423
AlexCatarino wants to merge 1 commit intoQuantConnect:masterfrom
AlexCatarino:feature-6411-wavetrend-oscillator

Conversation

@AlexCatarino
Copy link
Copy Markdown
Member

Description

Implements WaveTrendOscillator (a BarIndicator consuming IBaseDataBar) per the linked issue. Adds the indicator class, the WTO helper on QCAlgorithm.Indicators.cs, unit tests inheriting CommonIndicatorTests<IBaseDataBar>, and the reference CSV spy_wto.csv under Tests/TestData/.

The indicator produces two lines:

  • WT1 (primary Current.Value) — EMA(ci, averagePeriod)
  • WT2 (exposed via the Signal sub-indicator) — SMA(WT1, signalPeriod)

where

hlc3 = (High + Low + Close) / 3
esa  = EMA(hlc3, channelPeriod)
d    = EMA(|esa - hlc3|, channelPeriod)
ci   = (hlc3 - esa) / (0.015 * d)

IsReady tracks Signal.IsReady; WarmUpPeriod = 2 * channelPeriod + averagePeriod + signalPeriod - 3 (42 with the (10, 21, 4) defaults from the original TradingView script).

Related Issue

Closes #6411

Motivation and Context

Requested via #6411 to bring the WaveTrend Oscillator (popularized by LazyBear on TradingView) to LEAN's indicator library. It's a widely used momentum oscillator for spotting overbought/oversold conditions and WT1/WT2 crossovers; users following TradingView-style strategies currently have no built-in equivalent.

Requires Documentation Change

Yes — add the following entry to Documentation/Resources/indicators/IndicatorImageGenerator.py (in the indicators dict):

'Wave-Trend-Oscillator': IndicatorInfo(
    WaveTrendOscillator(10, 21, 4),
    'WaveTrendOscillator(10, 21, 4)',
    'WTO(_symbol, 10, 21, 4)',
    'self.wto(self._symbol, 10, 21, 4)'
),

How Has This Been Tested?

  • dotnet build QuantConnect.Lean.sln
  • dotnet test Tests/QuantConnect.Tests.csproj --filter "FullyQualifiedName~WaveTrendOscillatorTests" — 16/16 passing in ~6 s.
  • Reference TCI column in spy_wto.csv was generated with TA-Lib (talib.EMA, talib.SMA) from the public SPY daily data shipped in Data/equity/usa/daily/spy.zip, matching the generator from the issue comment thread. CommonIndicatorTests.ComparesAgainstExternalData verifies LEAN's WT1 matches to within 1e-3.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My branch follows the naming convention feature-<N>-<description>.

Implements the WaveTrend Oscillator (WTO) as a BarIndicator that
consumes High/Low/Close bar data and produces two lines: WT1 (the
main oscillator) and WT2 (an SMA signal line), following the formula
popularized by LazyBear on TradingView:

    hlc3 = (High + Low + Close) / 3
    esa  = EMA(hlc3, channelPeriod)
    d    = EMA(|esa - hlc3|, channelPeriod)
    ci   = (hlc3 - esa) / (0.015 * d)
    WT1  = EMA(ci, averagePeriod)
    WT2  = SMA(WT1, signalPeriod)

Adds the WaveTrendOscillator class, the WTO helper in
QCAlgorithm.Indicators.cs, unit tests inheriting
CommonIndicatorTests<IBaseDataBar>, and a reference CSV under
Tests/TestData/ generated with TA-Lib against the public SPY daily
data.

Closes QuantConnect#6411

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AlexCatarino AlexCatarino deleted the feature-6411-wavetrend-oscillator branch April 20, 2026 22:59
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.

Implement WaveTrend Oscillator Indicator

1 participant