Model Stacking
By LuxAlgoMay 30, 2026
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
How does stacking differ from ensemble voting?
Ensemble voting counts agreement between finished signals under a fixed rule. Stacking trains the combiner itself: the meta-learner fits the stored out-of-fold base predictions and can learn that one model deserves systematically more weight.
Why must the meta-learner train on out-of-fold predictions?
Trained on in-sample predictions, it would learn to trust each base exactly where that base memorized the data. Each bar's outputs are therefore computed before the label exists or any training touches it; only those stored values reach the meta-learner.
Do the plotted probabilities repaint?
No — each bar's value comes from the weights as they stood on that bar and is never revised. The models keep retraining as samples resolve, so similar conditions can map to different probabilities later, but history stays as printed.
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.
