# ARIMA Forecasts

ARIMA Forecasts is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Fits ARIMA models to log price on closed bars only, choosing the order by AIC or by hand, and projects a labeled model forecast with prediction bands from the last closed bar. A one-bar-ahead forecast track, earlier forecast fans and out-of-sample diagnostics show how the model fared against a no-change forecast, so the bands can be read as an expected range rather than a call.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Sep 16, 2026.
- Access: free.
- Concepts: [ARIMA forecasts](https://www.luxalgo.com/library/concept/arima-forecasts/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=ti1iabwxnreda8jy8k6jn4s2
- Page: https://www.luxalgo.com/library/indicator/arima-forecasts/

The **ARIMA Forecasts** indicator provides a sophisticated framework for time-series analysis by applying Autoregressive Integrated Moving Average (ARIMA) modeling to market data. By dynamically fitting to historical price action, it projects a potential future path accompanied by probabilistic uncertainty intervals. This tool allows users to quantify expectations for price movement, volatility, and trend persistence, offering a data-driven perspective on market dynamics through a rigorous statistical lens.

## How to Trade the ARIMA Forecasts?

The indicator visualizes a forecasted price path based on the most recent "Fit Window" of data. The primary forecast appears as a dashed line extending into the future, while the shaded regions represent confidence intervals derived from the model’s error variance. 

When observing the indicator, pay close attention to the "One-bar-ahead Forecast Track." This shows how the model performed in the immediate past. If price consistently closes outside the outer bands, it indicates that the market is experiencing volatility that exceeds the model's current statistical assumptions. Traders can use the dashboard to monitor the "RMSE vs No-change" metric; a value below 1.0 suggests the model is outperforming a random walk, indicating potential utility for the current market regime. Note that the forecast is not a guaranteed prediction of future price action but rather the conditional mean of the linear model, providing a baseline to assess whether current price behavior is statistically significant.

## ARIMA Forecasts Settings

### Model
*   **Source:** The price series used for model fitting.
*   **Model Log Price:** Fits the model to the natural log of price, suitable for percentage-based analysis.
*   **Order Selection:** Choose between "Auto (AIC)" to automatically find the optimal p and q parameters, or "Manual" for custom input.
*   **Max p and q (Auto):** Sets the limit for autoregressive and moving-average orders when in Auto mode.
*   **Re-select Every (bars):** Determines the frequency at which the Auto mode re-evaluates the optimal order.
*   **AR Order (p), d, q:** p and q set the ARIMA orders in Manual mode; d, the differencing order, is always set by hand and applies in both modes.
*   **Include Constant (Drift):** Adds a drift term, useful for identifying a trend bias within the fit window.
*   **Fit Window (bars):** Defines the historical data length used for model estimation.
*   **Refit Every (bars):** Controls how often the model re-estimates coefficients to adapt to new data.

### Forecast
*   **Forecast Horizon (bars):** The number of bars the projection extends into the future.
*   **Inner/Outer Band (%):** The inner band sets the interval drawn around the projection and the one-bar-ahead track; the outer band is not drawn and instead sets the Close Above/Below Outer Band markers and the second Band Coverage figure.

### Out-of-sample Track
*   **Track Length (bars):** The lookback period for evaluating the model against actual closed-bar data.
*   **One-bar-ahead Forecast Track:** Toggles the visual representation of previous one-step forecasts.
*   **Past Forecasts:** Displays earlier projections on the chart for comparative analysis.

## Frequently Asked Questions

### What is the difference between Manual and Auto order selection?
Manual mode allows you to specify fixed ARIMA parameters (p, d, q), which is useful if you have a specific statistical expectation for the asset. Auto mode uses the Akaike Information Criterion (AIC) to objectively select the best-fitting model parameters from a range of possibilities, reducing the risk of over-fitting.

### What do the confidence bands represent?
The bands represent prediction intervals based on the model's calculated error variance under the assumption of normally distributed residuals. The drawn band (the inner interval) widens as the forecast horizon increases, reflecting the accumulation of uncertainty in the projection.

### What does it mean if the Ljung-Box test shows "structure left"?
The Ljung-Box test evaluates whether the model’s residuals resemble white noise. A result indicating "structure left" (p-value below 0.05) suggests that the model has failed to capture all available information in the price series, implying that adjusting your p, d, or q orders could lead to a more accurate fit.

## Related indicators

- [Spline Quantile Regression Channel](https://www.luxalgo.com/library/indicator/spline-quantile-regression-channel/) (Polynomial Regression): markdown at https://www.luxalgo.com/library/indicator/spline-quantile-regression-channel.md
- [Bitcoin Power Law](https://www.luxalgo.com/library/indicator/bitcoin-power-law/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/bitcoin-power-law.md
- [Recursive Least Squares Forecast](https://www.luxalgo.com/library/indicator/recursive-least-squares-forecast/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/recursive-least-squares-forecast.md
- [Adaptive Harmonic Forecast](https://www.luxalgo.com/library/indicator/adaptive-harmonic-forecast/) (FFT/spectral Analysis): markdown at https://www.luxalgo.com/library/indicator/adaptive-harmonic-forecast.md
- [Kalman Filter](https://www.luxalgo.com/library/indicator/kalman-filter/) (Statistics): markdown at https://www.luxalgo.com/library/indicator/kalman-filter.md
- [Bitcoin Expectile Model](https://www.luxalgo.com/library/indicator/bitcoin-expectile-model/) (Quantile Regression): markdown at https://www.luxalgo.com/library/indicator/bitcoin-expectile-model.md
- [Rolling Segment](https://www.luxalgo.com/library/indicator/rolling-segment/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/rolling-segment.md
- [Daily Polynomial Regressions](https://www.luxalgo.com/library/indicator/daily-polynomial-regressions/) (Polynomial Regression): markdown at https://www.luxalgo.com/library/indicator/daily-polynomial-regressions.md

---

Source: https://www.luxalgo.com/library/indicator/arima-forecasts/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
