All indicators

Recursive Least Squares Forecast

By LuxAlgoFeb 9, 2026

Static chart image

Recursive Least Squares Forecast fits an adaptive linear regression whose slope and intercept are re-estimated on every bar, plotting the result as an equilibrium RLS Mean with volatility-adjusted bands. A forward "Ghost Line" projects the current estimate ahead, wrapped in standard-deviation forecast bands that visualize the model's uncertainty, a low-lag alternative to static fits.

How to Trade the Recursive Least Squares Forecast?

  • RLS Mean slope: a rising mean with an upward Ghost Line frames bullish conditions; a declining structure signals bearish pressure.
  • Outer band excursion: price beyond the Upper or Lower Band is statistically overextended for the current regime, the start of a mean-reversion setup.
  • BUY / SELL labels: printed when price crosses back inside the band; the RLS Mean serves as the natural profit objective.
  • Forgetting Factor tuning: values near 0.95 privilege recent action and pivot fast; values near 0.99 favor stability and smoothness.

The engine is an adaptive filter updated through a gain vector in a state-space framework, a form of online, incremental learning that discounts older observations instead of refitting a fixed window. That is what lets it pivot quickly through regime shifts without excessive lag or noise.

Recursive Least Squares Forecast Settings

  • Forgetting Factor (λ): how quickly older data is discounted. Higher is smoother and more stable, lower reacts faster to new prices.
  • Band Multiplier: scales the forecast standard deviation that sets the band width.
  • Forecast Horizon: how many bars ahead the Ghost Line and forecast bands project.
  • Show Ghost Line & Bands: toggles the forward projection and uncertainty bands.
  • Show Mean Reversion Signals: toggles the BUY and SELL labels.

Frequently Asked Questions

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5
Original indicatorBuilt in-house by LuxAlgo

The Library is free. Quant makes it yours.

Pull any concept or indicator into Quant: rebuild it, retune it, or turn it into a backtested strategy of your own.