Hi! I've found some strange code in DonchianChannel indicator.

protected override decimal ComputeNextValue(IBaseDataBar input)
{
    if (_previousInput != null)
    {
        UpperBand.Update(_previousInput.Time, _previousInput.High);
        LowerBand.Update(_previousInput.Time, _previousInput.Low);
    }

    _previousInput = input;
    return (UpperBand.Current.Value + LowerBand.Current.Value) / 2;
}


In “ComputeNextValue(IBaseDataBar input)” method we can see that “UpperBand” Maximum and “LowerBand” Minimum indicators are updated from the previous input. Does it means that indicator value is not actual and off by one DataBar? Is this a bug, or I misunderstood this part of code?

Author