
Many indicators can point to the right market direction, but in real trading the main problem is different: too many noisy and false signals. The ML Engine indicator is designed exactly for this — it does not replace your system, it filters your existing signals using machine learning and lets through only the most probable and robust ones.
In this article you will learn:
- what ML Engine is and when you should use it;
- how it combines multiple machine learning models into an ensemble;
- which market features it uses (VWAP, order flow, volatility, momentum and more);
- how to set probability and quality thresholds to cut off bad trades;
- how to connect ML Engine to your own NinjaTrader strategy and use the filtered signal for entries.
What Is ML Engine and What Problem Does It Solve?
ML Engine is a universal machine learning engine for signal filtering and probability forecasting inside NinjaTrader. It takes as input the directional signal from your existing indicator (for example, a trend, momentum or order flow signal) and outputs a filtered ML signal together with a probability estimate.
A key concept is that ML Engine does not generate entries on its own. It requires an Input Series from another indicator that already produces directional signals:
- > 0 – long signal;
- < 0 – short signal;
- 0 – no trade.
ML Engine then learns on historical data and current market context and decides whether it is worth passing this signal further or blocking it. This is an ideal tool if:
- your base strategy “sees” direction well but produces too many losing trades;
- your signals work in some regimes but fail in others (high volatility, flat sessions, news spikes);
- you want an adaptive filter that adjusts to changing market conditions instead of using fixed heuristics.
Important:
ML Engine requires an active NinjaTrader Order Flow + subscription, and it only works in combination with an external indicator that provides the directional input series.
Ensemble of Machine Learning Models: Why It Matters
One of the strongest sides of ML Engine is that it uses an ensemble of different ML models. Instead of relying on a single algorithm, it combines multiple classifiers and can automatically weigh them based on their performance metrics (AUC and F1).
ML Engine supports the following models:
- LightGbm – gradient boosting, great at capturing complex nonlinear relationships;
- FastTree – decision tree–based model, good for interpretable splits and regimes;
- FastForest – random forest–style ensemble, robust to noise;
- SDCA Logistic Regression – linear classifier, strong baseline for separable data;
- LBFGS Logistic Regression – another advanced optimizer for logistic regression;
- Averaged Perceptron – simple but fast online learning model;
- SGD Calibrated – stochastic gradient descent classifier with probability calibration.
You can enable or disable any model and let ML Engine auto‑weight them based on their out‑of‑sample performance. This provides:
- diversity of decision logic (trend, mean reversion, regime changes etc.);
- stability under noisy conditions;
- better generalization to new market environments.
Which Market Features Does ML Engine Use?
For accurate decision making ML Engine uses a rich feature set built from order flow, volatility, volume and price structure. You can configure many of them via the Feature Params section.
VWAP Slope and Deviation Zones
VWAP (Volume Weighted Average Price) acts as a dynamic “fair value” of the session. ML Engine can use:
- VWAP slope between configurable bars ago – to detect trend direction and strength;
- VWAP resolution (for example, tick‑based);
- VWAP standard deviations and multipliers – to build overbought/oversold zones around VWAP.
This helps the model understand whether your signal appears in a trend continuation area, a stretched deviation zone or a mean‑reversion context.
Cumulative Delta and Order Flow
ML Engine can include cumulative delta as a key order flow feature:
- you can choose the delta type (for example, Bid/Ask or Up/Down tick);
- you can specify the delta period (session‑based, etc.);
- you can apply a size filter to ignore insignificant volume noise.
Cumulative delta helps the model see whether aggressive buyers or sellers are dominating at the moment when your base indicator fires a signal.
Volatility, Momentum and Gaps
Additional features include:
- ATR period – volatility level of the instrument;
- MACD fast/slow/smooth – momentum and trend context;
- session gap from a configurable session start time.
Together these features allow ML Engine to distinguish between “normal” and extreme conditions, where the same raw signal can have completely different expected performance.
Controlling How Strictly ML Engine Filters Your Signals
The power of ML Engine comes from its ability to quantify how good a signal is. You can control the strictness of filtering using:
Minimum Signal Probability
The core setting is Min Probability (by default 0.5). The ensemble outputs a probability that the trade will be successful according to the trained models. If this probability is below your threshold, the signal is blocked.
Practical examples:
- 0.50–0.60 – mild filter, still passes many trades but removes the worst noise;
- 0.65–0.75 – balanced level for traders who want fewer but higher‑quality entries;
- 0.80+ – aggressive filtering, suitable for very selective, low‑frequency trading or for building “A‑setup only” strategies.
Metrics‑Based Quality Filter
Besides probability, ML Engine can monitor its own performance through an ML Metrics Filter. You can set minimum thresholds for:
- AUC (Area Under ROC Curve) – overall ranking quality of the classifier;
- F1 score – balance between precision and recall;
- Accuracy – share of correct predictions;
- Precision – how many predicted trades are actually good;
- Recall – how many good trades are being captured.
If metrics drop below your thresholds (for example in a regime change), ML Engine can block signals completely until the model recovers, helping protect the account during unstable periods.
Visual Feedback: Probability and Metrics Table on the Chart
To make ML‑based decisions transparent, ML Engine can display:
- a probability label directly on the chart near price, showing the current estimated probability for the active signal;
- a metrics table in a configurable corner of the chart, listing each model and ensemble‑level metrics.
You can customize:
- font, color and vertical offset (in ticks) for the probability label;
- table position, font, text color, background, outline and opacity.
This visual feedback makes it easy to understand why some signals are being filtered out and how confident the engine is when it lets a trade through.
How ML Engine Trains and Adapts Over Time
ML Engine can operate in an online learning mode:
- you specify how many bars ahead should be used to label training samples (for example, 60 bars ahead);
- you define the minimum number of records before retrain (for example, 10).
This means the engine constantly collects examples “signal → outcome after N bars” and periodically retrains the models. As a result, your filter does not stay static — it adapts to changes in volatility, microstructure and trader behavior.
Using ML Engine Inside Your Own NinjaTrader Strategy
For developers, ML Engine exposes a clean API so you can call it directly from your NinjaScript strategies and use the filtered ML output for entries and exits.
1. Provide a Base Directional Signal
First, your strategy needs an indicator that outputs a signed signal:
- > 0 – long bias;
- < 0 – short bias;
- 0 – flat / no trade.
A typical example is a simple EMA crossover:
whenever the fast EMA crosses above the slow EMA, you set the base signal to +1,
and when it crosses below you set it to -1. This base signal is then passed to ML Engine
as its Input Series.
2. Add Required Data Series
ML Engine requires two additional data series in your strategy:
a Tick series and a Daily series.
They must be added in the State.Configure block.
Without them, the engine will not function correctly, because it needs both micro‑ and higher‑timeframe context.
3. Instantiate ML Engine and Connect Your Signal
In the State.DataLoaded state you:
- instantiate your base indicators (for example, EMAs);
- create a
Series<double>for the base signal; - create an instance of ML Engine using the
MLEngine(...)NinjaScript method, passing your base signal as the first parameter; - optionally, add ML Engine as a chart indicator to see probabilities and metrics visually.
4. Use the Filtered ML Signal for Entries
On each bar (usually only on the primary series) you:
- check that there are enough historical bars on all series (main and daily);
- calculate the base signal according to your logic and assign it to
BaseSignal[0]; - read
mlengine.MLSignal[0]– this is the filtered machine‑learning output; - enter long if
MLSignal[0] > 0, enter short ifMLSignal[0] < 0, or stay flat otherwise.
This pattern is universal: you can plug in any indicator that outputs signed signals (order flow, momentum, custom logic) and let ML Engine decide when these signals are worth trading.
When Does ML Engine Make the Biggest Difference?
ML Engine is especially valuable if:
- you trade systematic strategies and want to cut the tail of bad trades without over‑fitting by hand;
- your approach is sensitive to regime changes (e.g. from trend to range);
- you use order flow and VWAP and want a higher‑level engine to make sense of all the variables;
Instead of creating tens of hard filters (time of day, volatility filters, volume thresholds), you can delegate this task to a machine learning ensemble that learns from real outcomes and adapts over time.
Conclusion
ML Engine turns your existing indicator signals into a probability‑aware, adaptive decision layer. It does not replace your system’s logic — it enhances it by:
- filtering out low‑quality and noisy signals;
- leveraging an ensemble of diverse ML models;
- using rich market features (VWAP, cumulative delta, ATR, MACD, gaps and more);
- providing clear visual feedback directly on the chart;
- integrating cleanly with NinjaTrader strategies through the
MLSignaloutput.
If you are looking for a way to reduce false signals and improve the overall quality of your trades without rewriting your entire system, ML Engine is a powerful, flexible solution that can be dropped on top of your current setup.
You can find ML Engine in our ASF Pack.