All indicators

Model Stacking

By LuxAlgoMay 30, 2026

Model Stacking is an indicator on Vela, our next-generation charting platform, written in Pine Script®.

Static chart image

Model Stacking runs a stacked ensemble bar by bar: three logistic base learners (momentum, mean reversion and volume/volatility) and a meta-learner that blends their outputs into one probability of price closing higher after the prediction horizon. The mechanical heart of model stacking is respected: every stored base prediction is out-of-fold, made before its outcome is known or trained on. The stacked line plots 0-100% with a gradient fill, dashed thresholds and, optionally, the three base probabilities behind it.

How to Trade the Model Stacking?

  • Cross above the Upper Threshold: decisively bullish; below the Lower Threshold is the bearish mirror, both alerted, as are 50% midline crosses.
  • Line hugging 50%: the bases disagree or the ridge penalty is keeping the combiner cautious. The stack has no opinion, itself usable information.
  • Read the dashboard first: each base's learned weight and out-of-sample hit rate, the stack's own hit rate, and its edge over the best base: whether blending adds anything here.

Model Stacking Settings

  • Prediction Horizon (default 5): bars ahead each model predicts.
  • Feature Length (default 14): lookback behind the nine normalized features.
  • Training Window (default 200): resolved out-of-fold samples kept for training and hit-rate measurement.
  • Base Learning Rate (default 0.5) and Meta Learning Rate (default 0.2): gradient steps of the once-per-bar, walk-forward training pass.
  • Meta Ridge (L2) (default 0.02): shrinks the meta weights so the combiner stays simple.
  • Upper Threshold (default 60) and Lower Threshold (default 40): the decisive-signal levels.
  • Show Base Model Probabilities (on) and Show Dashboard (on, Top Right, Small).

Frequently Asked Questions

Free to use

Run it on Vela. Go further with a paid plan.

  • Up to 500 Custom Alerts, with webhook automation
  • Up to 10× the chart history of Free
  • Orderflow lookback up to full history
  • More Quant usage to customize it, plus extra usage when you need it
  • Futures data alongside crypto, stocks, forex and commodities
See plans
Original indicatorBuilt in-house by LuxAlgo

Run it on Vela. Make it yours with Quant.

Open this indicator free on Vela, our next-generation charting platform. Then ask Quant, our coding agent built into Vela, to retune it or turn it into a backtested strategy of your own.