Repository navigation
Fix CCI, DPO, Ehlers Fisher, Connors RSI and STC to match their definitions - #537
Merged
Merged
Conversation
The mean deviation compared each typical price with its own bar's SMA and then averaged with a second SMA. Lambert's definition, and TA-Lib CCI, compare every typical price in the window with the current SMA. The idle period drops from 2*Period-2 to Period-1. The expected values in cci.csv and cci_strategy.csv are regenerated from TA-Lib CCI. Fixes #521. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DPO computed Price[t] - SMA[t-k]. The definition, and TA-Lib DPO, use Price[t-k] - SMA[t]. The idle period drops from Period-1+k to max(Period-1, k). The expected values in dpo.csv are regenerated from TA-Lib DPO and compared at 4 digits, since 2-digit rounding hits exact ties with this data. Fixes #522. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The transform multiplied the log term by an extra 0.5, and clamped Value1 at 0.999 instead of setting it to 0.999 once it passes 0.99. Both now follow Ehlers' article and TA-Lib FISHER. The expected values, including the hand-computed ones, are regenerated from TA-Lib FISHER, and a new test covers the clamp. Fixes #523. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
helper.PercentRank(period) ranks against period-1 preceding values, so Connors RSI ranked against 99. Connors' definition, and TA-Lib CRSI, use 100. The first value moves from bar 100 to bar 101. The expected values in connors_rsi.csv are regenerated from TA-Lib CRSI. Fixes #524. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
STC smoothed each stochastic pass with an SMA(3) %D. Schaff's definition, and TA-Lib STC, smooth each pass exponentially with a factor of 0.5, which DPeriod now sets as 2/(DPeriod+1). The MACD's fast EMA is also seeded on the slow EMA's first bar, as in TA-Lib, since the stochastic magnifies seeding differences for hundreds of bars. API: the Stochastic and Apo fields are replaced by FastEma and SlowEma. The idle period moves from 71 to 67 bars with the defaults. Adds a value test against TA-Lib STC (stc.csv) and a flat-input test. Fixes #525. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #537 +/- ##
=======================================
Coverage 91.80% 91.81%
=======================================
Files 240 240
Lines 7835 7843 +8
=======================================
+ Hits 7193 7201 +8
- Misses 549 550 +1
+ Partials 93 92 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes five indicators that differed from their published definitions, as found by the TA-Lib comparison in #536. Each now matches TA-Lib 0.8.3 on both reference datasets, and its
skip:entry ininternal/talibcompatis removed.Close[t−k] − SMA[t]instead ofClose[t] − SMA[t−k]* 0.5; Value1 is set to ±0.999 once it passes ±0.99Review notes
StochasticandApofields are replaced byFastEmaandSlowEma.NewStcWithPeriodkeeps its signature;DPeriodnow sets the smoothing factor2 / (DPeriod + 1), so the default 3 gives Schaff's 0.5.MacdandApostart the fast EMA earlier (documented in Document smaller TA-Lib differences: EMA seeding, McGinley start, RVI name, VWAP window #535). Without this, STC still differed by about 1.5 points after 200 bars, because the stochastic magnifies small MACD differences. The doc comment notes the difference.cci.csv,dpo.csv,ehlers_fisher.csv,connors_rsi.csvand the newstc.csvare regenerated from TA-Lib using each file's own inputs, rounded the wayhelper.RoundDigitrounds. The CCI example strategy's expected actions are regenerated from TA-Lib CCI.* 0.5. They are replaced with TA-Lib FISHER output, and a new test covers the clamp in both directions.trend/dpo_test.go.Testing
fmt, vet, gosec, staticcheck, revive,
go test -raceover all packages, and gomarkdoc all pass. Coverage of the changed files is unchanged from before.🤖 Generated with Claude Code