Skip to content

Report the extra bar three candlestick patterns wait for - #9710

Open
mkzung wants to merge 2 commits into
QuantConnect:masterfrom
mkzung:bug-9709-candlestick-warmup-period
Open

Report the extra bar three candlestick patterns wait for#9710
mkzung wants to merge 2 commits into
QuantConnect:masterfrom
mkzung:bug-9709-candlestick-warmup-period

Conversation

@mkzung

@mkzung mkzung commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Description

AbandonedBaby, MatHold and RiseFallThreeMethods override IsReady to Samples > Period and
leave WarmUpPeriod at WindowIndicator's Period, so each turns ready one bar after the count it
publishes. The override returns Period + 1.

Related Issue

Closes #9709

Motivation and Context

WarmUpIndicator feeds exactly WarmUpPeriod bars and hands back an indicator the caller treats as
ready. For these three it is not, and the first value read after warming up is 0.

Changing the comparison instead would move what the patterns report. Accumulation runs under
if (!IsReady), so readiness a bar earlier drops one term from every average and the TA-Lib fixture
values move with it. Period + 1 changes no value anywhere. If you would rather these three matched
the other 58 and used >=, that is a larger change and I am happy to do it that way instead.

The other 58 patterns already agree with their own WarmUpPeriod. EveningDojiStar and
MorningDojiStar carry AbandonedBaby's three candle settings and declare ... + 2 + 1 against its
... + 2; Breakaway and LadderBottom have MatHold's exact period expression with >=.

Requires Documentation Change

No.

How Has This Been Tested?

Added WarmsUpProperly to CandlestickPatternTests, matching CommonIndicatorTests.WarmsUpProperly
and using the same PatternTestParameters source as the three tests already there.
CandlestickPatternTests does not derive from CommonIndicatorTests, so of the four shared tests
the patterns only ever ran two, which is why this went unseen.

My local NUnit host crashes in a Python.NET finalizer before any test runs, because
QuantConnect.pythonnet 2.0.65 wants Python 3.11 and this machine has 3.10. So the test was
replayed from a console program linked against QuantConnect.Indicators, running the same loop over
the same bars: 61 patterns pass, and reverting the three overrides fails exactly AbandonedBaby,
MatHold and RiseFallThreeMethods. The same program drives and resets all 177 constructible
indicators and finds no other disagreement between WarmUpPeriod and IsReady.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My branch follows the naming convention bug-<issue#>-<description> or feature-<issue#>-<description>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Three candlestick patterns report a WarmUpPeriod one bar short

1 participant