Skip to content

Three candlestick patterns report a WarmUpPeriod one bar short #9709

Description

@mkzung

Expected Behavior

WarmUpPeriod is the number of data points an indicator needs before IsReady turns true.
WarmUpIndicator feeds exactly that many and hands back a ready indicator.

Actual Behavior

AbandonedBaby, MatHold and RiseFallThreeMethods each turn ready one bar later than they
report.

AbandonedBaby         WarmUpPeriod 12, ready at sample 13
MatHold               WarmUpPeriod 15, ready at sample 16
RiseFallThreeMethods  WarmUpPeriod 15, ready at sample 16

WindowIndicator.WarmUpPeriod => Period holds while IsReady is the window's own. These three
override IsReady to Samples > Period and leave WarmUpPeriod alone. The other 58 candlestick
patterns use Samples >= Period.

Reproducing the Problem

var pattern = new AbandonedBaby();
for (var i = 0; i < pattern.WarmUpPeriod; i++)
{
    pattern.Update(new TradeBar(new DateTime(2019, 1, 1).AddDays(i), Symbols.SPY,
        100m + i, 105m + i, 95m + i, 100m + i, 100m, Time.OneDay));
}
Console.WriteLine(pattern.IsReady);  // False

CommonIndicatorTests.WarmsUpProperly asserts exactly this, and CandlestickPatternTests does not
derive from CommonIndicatorTests, so it has never run for any pattern.

Same surface as #8629, different cause: there WarmUpPeriod is absent, here it is present and one
short.

System Information

master at d865a40.

Checklist

  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions