Add WaveTrend Oscillator indicator#9424
Closed
AlexCatarino wants to merge 1 commit intoQuantConnect:masterfrom
Closed
Add WaveTrend Oscillator indicator#9424AlexCatarino wants to merge 1 commit intoQuantConnect:masterfrom
AlexCatarino wants to merge 1 commit intoQuantConnect:masterfrom
Conversation
Implements WaveTrendOscillator (BarIndicator consuming IBaseDataBar) per issue QuantConnect#6411. 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(|HLC3 - ESA|, channelPeriod) (fed only after ESA is ready) 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 LazyBear TradingView script). The division is guarded so that bars with no intra-channel variation (e.g. flat volume-renko bars) return 0 instead of dividing by a near-zero D. Reference values were generated via TA-Lib (talib.EMA, talib.SMA) on the public SPY daily data shipped in Data/equity/usa/daily/spy.zip, matching the generator script from the issue comment thread. 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 LazyBear TradingView script). The division is guarded so that bars with no intra-channel variation (e.g. flat volume-renko bars) return0instead of dividing by a near-zeroD.Related Issue
Closes #6411
Motivation and Context
Requested via #6411 (and the linked forum thread) to bring the WaveTrend Oscillator — popularized by LazyBear on TradingView — to LEAN's indicator library. It is 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 and have to re-implement it in every algorithm.
Requires Documentation Change
Yes — add the following entry to
Documentation/Resources/indicators/IndicatorImageGenerator.py(in theindicatorsdict):All parameters are integer periods, so no
msuffix is required on the C# entries.How Has This Been Tested?
dotnet build QuantConnect.Lean.sln— 0 errors.dotnet test Tests/QuantConnect.Tests.csproj --filter "FullyQualifiedName~WaveTrendOscillatorTests"— 15/15 passing.spy_wto.csvwere generated via TA-Lib (talib.EMA,talib.SMA) from the public SPY daily data shipped inData/equity/usa/daily/spy.zip, matching the generator script posted by @LouisSzeto in the issue comment thread.CommonIndicatorTests.ComparesAgainstExternalDataverifies LEAN'sWT1matches within1e-3and the additionalComparesWithExternalDataSignaltest verifiesWT2.Types of changes
Checklist:
feature-<N>-<description>