Repository navigation
fix(momentum): use a neutral IBS value for flat bars - #540
Merged
Merged
Conversation
A flat bar has no location within its high-low range. Return the neutral midpoint 0.5 rather than the low endpoint 0; cover float32 and float64 streams with flat and ordinary bars. Fixes cinar#532. Signed-off-by: Tianlang (Jackie) Chen <305351710+jackiectl2@users.noreply.github.com>
|
All contributors have signed the CLA ✍️ ✅ |
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #540 +/- ##
=======================================
Coverage 91.83% 91.83%
=======================================
Files 240 240
Lines 7843 7843
=======================================
Hits 7203 7203
Misses 548 548
Partials 92 92 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cinar
force-pushed
the
fix-flat-bar-ibs-neutral
branch
from
November 24, 2026 15:54
5662b04 to
b03034b
Compare
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.
Describe Request
A flat bar (High == Low) has no location within its high-low range, but
InternalBarStrengthcurrently returns 0 for it, the same value as a close at the low. This change returns the neutral midpoint 0.5 instead and documents it. The regeneratedmomentum/README.mdpicks up the doc comment.Fixes #532.
Change Type
Bug fix with a regression test.
TestInternalBarStrengthZeroDenomnow expects 0.5, and a new float32 test mixes flat and ordinary bars. Both fail onmasterand pass with the change;ibs.gostays at 100% coverage.tasksteps locally with Go 1.22 (the version ingo.modthat CI uses):go fix,go vet, gosec v2.20.0, staticcheck v0.5.1 and revive v1.3.4 report nothing;go test -race ./...passes;gomarkdoconly changesmomentum/README.md.Checklist