Why Single Models Fail in Financial Markets
Financial markets are non-stationary: their statistical properties change over time. A model trained on 2020–2022 data — which includes a global pandemic, central bank intervention, and extraordinary volatility — will learn patterns that are simply not present in 2024–2026 data.
A single machine learning model, however sophisticated, reflects the specific statistical distribution it was trained on. When market conditions shift — as they inevitably do — the model's edge erodes and it begins to produce false signals.
Ensemble methods address this by combining multiple models with different assumptions, different lookback periods, and different statistical focuses. The ensemble's aggregate signal is more stable than any individual component because a regime change that breaks one model is unlikely to break all of them simultaneously.
This is the same logic behind diversification in portfolio construction: not all assets fall simultaneously. In ML ensembles, not all models misfire simultaneously.
The 8 Models in the Quantum DeCasteljau Ensemble
Each model contributes a directional score (typically -1 to +1 or a probability) to the ensemble. The weighted sum determines the final signal strength.
1. Linear Regression
The simplest model in the ensemble and deliberately included as a baseline. Linear regression over a rolling window estimates the slope and intercept of the price series, providing a fundamental trend direction estimate. It is fast, interpretable, and provides a stable foundation for the ensemble — when no other model has strong conviction, linear regression prevents the ensemble from generating spurious signals.
2. Logistic Regression (Binary Classification)
Logistic regression transforms the linear model output into a probability estimate: specifically, the probability that the next bar's close will be above the current close. This probabilistic output is a natural fit for ensemble aggregation and provides a soft signal (strength of conviction) rather than a binary in/out.
3. XGBoost Decision Stumps
XGBoost (Extreme Gradient Boosting) stumps are depth-1 decision trees — single feature thresholds — that are aggregated via gradient boosting. In Pine Script, this is approximated by a fixed set of hand-optimised decision rules applied to a feature vector of price statistics (ATR ratio, RSI, close vs EMA, volume relative to average). The boosting weights are pre-calculated and embedded as constants. This captures non-linear relationships between features that linear models miss.
4. Multi-Head Attention (Transformer-Style)
Inspired by the Transformer architecture in natural language processing, the attention module computes a weighted relevance score for each recent price bar based on its similarity to the current bar's feature vector. Bars that are contextually similar to the current market state receive higher attention weight.
In Pine Script, this is implemented as a softmax-weighted sum over a lookback window, where the attention scores are computed from the dot product of each historical bar's normalised feature vector with the current bar's features. This allows the model to 'remember' relevant historical patterns even if they occurred many bars ago.
5. Hurst Exponent (Regime Classifier)
As described in the Hurst Exponent guide, this model contributes a regime classification (trending/random/mean-reverting) that adjusts the weighting of other ensemble members. It is not a directional model — it is a meta-model that modulates the ensemble's overall behaviour.
6. Monte Carlo Probability Bias
A simplified Monte Carlo simulation runs thousands of synthetic price paths (based on the historical return distribution of the current instrument estimated over the last N bars) and computes the proportion that end above the current price at a horizon of K bars ahead. This proportion, net of 0.5, is the directional bias contributed to the ensemble. A value of 0.65 (65% of simulated paths end above current price) contributes a positive signal; 0.35 contributes negative.
7. Array Rotation Pattern Library
The array rotation model maintains a library of recent N-bar price patterns (encoded as normalised return sequences). On each bar, the current N-bar pattern is compared to the library using cosine similarity. The top-K most similar historical patterns are retrieved, and the average subsequent return over the next M bars for those patterns provides the directional signal. This is a nearest-neighbour approach in pattern space.
8. Kalman Velocity
The Kalman filter's velocity estimate (described in the Kalman Filter guide) provides a smooth, model-based estimate of the current rate of price change. Positive velocity (filtered price accelerating upward) contributes a positive signal; negative velocity contributes negative. The magnitude of the velocity score scales with the confidence the filter has in its estimate.
Ensemble Weighting and Signal Generation
The eight model scores are aggregated using a dynamic weighting scheme. Each model's weight is adjusted based on its recent accuracy over the last 50 confirmed bars — models that have been more accurate recently receive higher weight.
The weighted sum produces a composite score. Signals are generated when this score crosses a configurable threshold. The threshold determines the trade-off between signal frequency and precision: a higher threshold filters out marginal signals and produces fewer but higher-conviction entries.
This self-adjusting mechanism means the ensemble naturally favours the models that best describe current market conditions — and reduces the influence of models that have been temporarily misaligned with recent market behaviour.
The ML Dashboard in Quantum DeCasteljau shows each model's current contribution in real time, so you can see which models are driving the signal and how aligned they are.