Expected Behavior
AutoRegressiveIntegratedMovingAverage either fits an order set its constructor accepts, or refuses it at construction.
Actual Behavior
168 of the 534 order sets the constructor admits throw on the bar that fills the rolling window, before the indicator ever reports ready. ComputeNextValue reads, over a series of length period - diffOrder:
line 201 arrayData[i] i < arOrder needs length >= arOrder
line 209 _residuals[maOrder+i+1] i < maOrder needs length >= 2*maOrder + 1
The constructor checks only period < Math.Max(arOrder, maOrder). That never mentions diffOrder, although DifferenceSeries shortens the series it is validating, and it compares against maOrder where the second read needs 2*maOrder + 1. Its message also says "must exceed" while the condition admits period == arOrder, the same mismatch as #9725.
HandleExceptions defaults to true and promises a zero value, but it wraps only AutoRegressiveStep and MovingAverageStep. Both of these reads are in ComputeNextValue, outside it, so the exception reaches the caller. QCAlgorithm.ARIMA passes its arguments straight to this constructor.
| order set |
accepted from |
first period that works |
| ARIMA(1, 0, 1) |
1 |
3 |
| ARIMA(1, 1, 1) |
1 |
4 |
| ARIMA(2, 1, 2) |
2 |
6 |
Potential Solution
Ask for what the reads need, Math.Max(arOrder, 2 * maOrder + 1) + Math.Max(diffOrder, 0). The clamp matters because nothing validates diffOrder as non-negative and DifferenceSeries runs only when it is positive, so a negative one costs no samples. That admits 366 of the 600 order sets and none of them throws, so no configuration that works today is refused.
Reproducing the Problem
var arima = new AutoRegressiveIntegratedMovingAverage(1, 1, 1, 3, true);
var start = new DateTime(2020, 1, 1);
for (var i = 0; i < 4; i++)
{
arima.Update(start.AddDays(i), 100m + (0.37m * i));
}
Throws ArgumentOutOfRangeException on the third update. ARIMA(1, 0, 1) at period 2 and ARIMA(1, 2, 0) at period 2 are the smallest cases at each of the two reads.
System Information
macOS 15, .NET 10, current master at 07fb018.
Checklist
Expected Behavior
AutoRegressiveIntegratedMovingAverageeither fits an order set its constructor accepts, or refuses it at construction.Actual Behavior
168 of the 534 order sets the constructor admits throw on the bar that fills the rolling window, before the indicator ever reports ready.
ComputeNextValuereads, over a series of lengthperiod - diffOrder:The constructor checks only
period < Math.Max(arOrder, maOrder). That never mentionsdiffOrder, althoughDifferenceSeriesshortens the series it is validating, and it compares againstmaOrderwhere the second read needs2*maOrder + 1. Its message also says "must exceed" while the condition admitsperiod == arOrder, the same mismatch as #9725.HandleExceptionsdefaults to true and promises a zero value, but it wraps onlyAutoRegressiveStepandMovingAverageStep. Both of these reads are inComputeNextValue, outside it, so the exception reaches the caller.QCAlgorithm.ARIMApasses its arguments straight to this constructor.Potential Solution
Ask for what the reads need,
Math.Max(arOrder, 2 * maOrder + 1) + Math.Max(diffOrder, 0). The clamp matters because nothing validatesdiffOrderas non-negative andDifferenceSeriesruns only when it is positive, so a negative one costs no samples. That admits 366 of the 600 order sets and none of them throws, so no configuration that works today is refused.Reproducing the Problem
Throws
ArgumentOutOfRangeExceptionon the third update.ARIMA(1, 0, 1)at period 2 andARIMA(1, 2, 0)at period 2 are the smallest cases at each of the two reads.System Information
macOS 15, .NET 10, current
masterat 07fb018.Checklist
masterbranch