Add WaveTrend Oscillator indicator#9423
Closed
AlexCatarino wants to merge 1 commit intoQuantConnect:masterfrom
Closed
Add WaveTrend Oscillator indicator#9423AlexCatarino wants to merge 1 commit intoQuantConnect:masterfrom
AlexCatarino wants to merge 1 commit intoQuantConnect:masterfrom
Conversation
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>
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(aBarIndicatorconsumingIBaseDataBar) per the linked issue. Adds the indicator class, theWTOhelper onQCAlgorithm.Indicators.cs, unit tests inheritingCommonIndicatorTests<IBaseDataBar>, and the reference CSVspy_wto.csvunderTests/TestData/.The indicator produces two lines:
WT1(primaryCurrent.Value) —EMA(ci, averagePeriod)WT2(exposed via theSignalsub-indicator) —SMA(WT1, signalPeriod)where
IsReadytracksSignal.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 theindicatorsdict):How Has This Been Tested?
dotnet build QuantConnect.Lean.slndotnet test Tests/QuantConnect.Tests.csproj --filter "FullyQualifiedName~WaveTrendOscillatorTests"— 16/16 passing in ~6 s.TCIcolumn inspy_wto.csvwas generated with TA-Lib (talib.EMA,talib.SMA) from the public SPY daily data shipped inData/equity/usa/daily/spy.zip, matching the generator from the issue comment thread.CommonIndicatorTests.ComparesAgainstExternalDataverifies LEAN'sWT1matches to within1e-3.Types of changes
Checklist:
feature-<N>-<description>.