Discussing the article: "How to implement AutoARIMA forecasting in MQL5"

 

Check out the new article: How to implement AutoARIMA forecasting in MQL5.

This article presents an MQL5 implementation of AutoARIMA that builds ARIMA models without manual tuning. It estimates d via a variance-based heuristic, fits ARMA(p,q) by gradient optimization with Adam, and selects p and q using AICc. The code returns a one-step-ahead price forecast by differencing, model estimation, and integration back to price level, ready to call on a Close series.

You want a practical one-step-ahead price forecast directly in the trading terminal, but ARIMA workflows create two common barriers: manual selection of p, d, and q and statistically robust parameter estimation that is awkward to embed in MQL5. This work addresses that engineering problem by providing a compact, reproducible procedure that accepts a single MQL5 array of recent closes (Close[0] = most recent) and returns a numeric forecast for the next close.

The implemented approach automates the full pipeline:

  • (1) estimate differencing order d with a variance-based heuristic and apply differencing to obtain stationarity,
  • (2) fit ARMA(p,q) models for a small grid of orders using SSE minimization with gradient-based updates and the Adam optimizer (coefficients clipped for stability),
  • (3) select the best model by corrected AIC (AICc),
  • and (4) invert differencing and round to tick size to produce a one-step price forecast.

Default limits (e.g., max p/max q = 5) and the one-step scope are explicit engineering choices to keep the routine reliable and fast for real-time use.

Author: Osmar Sandoval Espinosa