MidPrice holds a Maximum and a Minimum and never overrides Reset(), so both keep the previous run's window. The first bars after a reset are computed from data that is no longer in scope.
Steps to reproduce, four bars, period 3:
var mid = new MidPrice(3);
// High/Low: 110/100, 111/101, 112/102, 105/95
// first run: 105, 105.5, 106, 103.5
mid.Reset();
// after reset: 103.5, 103, 106, 103.5
Expected the second pass to repeat the first. The first period - 1 values are wrong, after which the stale window has rolled out: 1 value at period 2, 2 at period 3, 4 at period 5, 9 at period 10. MidPrice(5) is what MidPriceTests constructs.
Reset() does clear the public surface, Samples is 0, IsReady is false and Current.Value is 0, which is why TestHelper.AssertIndicatorIsInDefaultState passes. It recurses into public sub-indicator properties, and these two are private fields.
Behaviour outside a reset is unaffected. Feeding Tests/TestData/spy_midprice.txt matches all 496 expected MIDPRICE_5 values both before and after the fix.
MidPrice holds a Maximum and a Minimum and never overrides Reset(), so both keep the previous run's window. The first bars after a reset are computed from data that is no longer in scope.
Steps to reproduce, four bars, period 3:
Expected the second pass to repeat the first. The first period - 1 values are wrong, after which the stale window has rolled out: 1 value at period 2, 2 at period 3, 4 at period 5, 9 at period 10. MidPrice(5) is what MidPriceTests constructs.
Reset() does clear the public surface, Samples is 0, IsReady is false and Current.Value is 0, which is why TestHelper.AssertIndicatorIsInDefaultState passes. It recurses into public sub-indicator properties, and these two are private fields.
Behaviour outside a reset is unaffected. Feeding Tests/TestData/spy_midprice.txt matches all 496 expected MIDPRICE_5 values both before and after the fix.