Add WaveTrend Oscillator indicator#9429
Open
AlexCatarino wants to merge 1 commit intoQuantConnect:masterfrom
Open
Add WaveTrend Oscillator indicator#9429AlexCatarino wants to merge 1 commit intoQuantConnect:masterfrom
AlexCatarino wants to merge 1 commit intoQuantConnect:masterfrom
Conversation
Implement WaveTrendOscillator (WTO), a momentum oscillator whose main
line (TCI) measures how far a smoothed typical price has deviated from
its own moving average, normalized by the average absolute deviation
and further exponentially smoothed. The signal line (WT2) is a short
simple moving average of the main line.
Formula:
hlc3 = (High + Low + Close) / 3
esa = EMA(hlc3, channelPeriod)
d = EMA(|esa - hlc3|, channelPeriod)
ci = (hlc3 - esa) / (0.015 * d)
tci = EMA(ci, averagePeriod) (main line)
wt2 = SMA(tci, signalPeriod) (signal line)
Adds the indicator class, the WTO helper in QCAlgorithm.Indicators.cs,
unit tests inheriting CommonIndicatorTests<IBaseDataBar>, and the
reference CSV under Tests/TestData/ generated from TA-Lib per the
Python script contributed on issue QuantConnect#6411.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements
WaveTrendOscillator(bar indicator, extendsBarIndicator) per the linked issue. Adds the indicator class, theWTOhelper inQCAlgorithm.Indicators.cs, unit tests inheritingCommonIndicatorTests<IBaseDataBar>, and the reference CSV underTests/TestData/.The main line (TCI) is a further exponential smoothing of a normalized channel index derived from HLC3 and its EMA; the Signal line (WT2) is a short simple moving average of the main line:
Defaults match the TradingView reference script:
channelPeriod=10,averagePeriod=21,signalPeriod=4.Related Issue
Closes #6411
Motivation and Context
The WaveTrend Oscillator is a widely-followed momentum oscillator on TradingView for identifying overbought/oversold conditions and crossover signals between the main and signal lines. Issue #6411 requested it as a first-class LEAN indicator so algorithms can use it without hand-rolling the EMA/SMA chain. Reference: https://www.tradingview.com/script/2KE8wTuF-Indicator-WaveTrend-Oscillator-WT/
Requires Documentation Change
Yes — QuantConnect/Documentation#2309
How Has This Been Tested?
dotnet build QuantConnect.Lean.slndotnet test Tests/QuantConnect.Tests.csproj --filter "FullyQualifiedName~WaveTrendOscillatorTests"— all 12 tests pass (main-line external-data comparison, signal-line external-data comparison, reset, warm-up, renko, volume-renko, time-moves-forward, etc.)talib.EMA,talib.SMA) using the exact script contributed on issue Implement WaveTrend Oscillator Indicator #6411; main and signal lines match within1e-4.Types of changes
Checklist:
feature-<issue>-<description>