You downloaded an EA that says "built-in AI model." It has an .onnx file bundled inside. The seller says it uses machine learning to predict price direction.
But what is that file actually doing on your computer? Where did it come from? And does it actually help you make money?
We've been testing ONNX-powered EAs at FXTool for the past year. This is what we've learned about what's really going on under the hood.
What the .onnx file does on your machine
An .onnx file is a math recipe. That's it.
Inside the file: thousands to millions of numbers (called weights) and a set of calculation steps. When your EA loads this file and feeds it data, here's what happens, mechanically:
- Your EA collects recent market data. Say, the last 60 H1 candles of open, high, low, close.
- Those numbers get formatted into an array and passed to the ONNX model.
- The model runs them through layers of matrix multiplication, addition, and simple math functions (ReLU, sigmoid, softmax).
- Out the other end comes a result. A number, or a few numbers. Maybe 0.73, meaning "73% probability the next candle is bullish."

That's the entire process. No thinking. No understanding. Matrix math with learned coefficients.
Think of it like a calculator. You type in 123 × 456, it gives you 56,088. It doesn't know what those numbers mean. It just follows the formula. An ONNX model is the same thing, except the formula is much more complex and was derived from data instead of being written by hand.
Speed: this entire calculation takes microseconds on a modern CPU. Faster than you can blink. That's why it can run on every single bar without slowing your EA down.
If you want to know how this fits into the broader picture of what EAs are and how they work, start there.
How the model gets trained
The .onnx file didn't appear from nowhere. Someone built it. Here's how, in plain terms.
Think of it like learning to cook a new dish.
Step 1: Gather ingredients (data). You export historical price data from MT5. Thousands of candles, sometimes tens of thousands. Open, high, low, close, volume. Maybe add some indicator values like RSI or ATR. This is your training data.
Step 2: Pick a recipe (model architecture). You decide what kind of "calculator" to build. Simple options: decision trees, random forests, XGBoost. Complex options: LSTM (good with sequences), CNN (good at pattern detection), or combinations. The choice depends on what you're trying to predict and how much data you have.
Step 3: Cook (train). You feed the data into the model and let it adjust its internal numbers (weights) over thousands of iterations. Each round, it makes predictions, compares them to what actually happened, and tweaks the weights to be slightly less wrong. This is called gradient descent. It runs in Python using libraries like TensorFlow, PyTorch, or scikit-learn.
Step 4: Taste test (validate). You test the model on data it has never seen. This is the step most people skip or get wrong. If the model scores 80% accuracy on training data but only 50% on unseen data, it memorized the training set instead of learning real patterns. That's overfitting, and it's the most common way ML trading projects fail.
Step 5: Package (export). If validation looks good, you export the trained model to .onnx format. One line of code: tf2onnx for TensorFlow, torch.onnx.export() for PyTorch, skl2onnx for scikit-learn. The file goes into your EA, and you're live.

The whole process happens in Python, outside of MetaTrader. MQL5's official ONNX.Price.Prediction project includes a ready-to-use training script if you want to see the actual code.
What types of models you can build
Think about what question you want the model to answer:
| Your question | What the model does | What comes out | Example |
|---|---|---|---|
| Will the next candle go up or down? | Direction classification | Up/Down + probability | XGBoost classifier |
| What will the closing price be? | Price regression | A price number | LSTM regressor |
| Is the market trending or ranging? | State classification | Trend/Range/Transition | CNN pattern detector |
| Is this signal worth taking? | Signal filtering | Confidence 0-100% | Noise filter on top of existing rules |
| How volatile will the next session be? | Volatility forecast | A number (expected range) | GARCH-neural hybrid |
The first two rows get all the attention, but in our experience, the last three are where ONNX models actually earn their keep. More on that below.
You're not limited to one type. Some EAs stack multiple models: one classifies market state, another predicts direction within that state, a third estimates position size based on expected volatility. The ONNX format handles all of these the same way.
Does it actually work?
It depends on what you mean by "work" and how it's used.
We've tested enough ONNX EAs to sort this into three buckets.
Where it works
Signal filtering is the most consistently useful application. You already have a rule-based strategy that generates signals. The ONNX model acts as a second opinion: "this signal has a 78% confidence score, take it" vs "this one scores 34%, skip it." This doesn't require the model to predict the future. It just needs to distinguish strong setups from weak ones. That's a much easier problem.
Volatility-based position sizing is the second win. The model predicts how much the price is likely to move in the next session. Your EA uses that number to adjust lot size: smaller when volatility is expected to spike, larger when conditions are calm. Again, you're not asking the model to predict direction. Just magnitude. Research shows this approach improves risk-adjusted returns even when direction prediction is mediocre.
Market state detection is the third. Different strategies work in different market conditions. A trend-following EA bleeds money in range markets. A mean-reversion EA gets destroyed in breakouts. If an ONNX model can reliably tell you "we're in a trending state right now," you can switch strategy parameters accordingly. Our guide to risk management covers why this matters.
Where it's shaky
Pure direction prediction for trade decisions is where most people expect ONNX to shine, and it's where results are least reliable. Academic papers report R² values of 0.96 and accuracy rates of 75%+. These numbers are real, on the test set, in the paper. In live trading with spreads, slippage, and changing market conditions, the edge shrinks fast.
A comprehensive analysis of ML models for algorithmic trading found that Random Forest and SGD models outperformed others in some tests, but concluded: "no singular strategy provides reliable solutions across all conditions." Mean reversion models fail during breakouts. Trend models fail during reversals. ML doesn't magically solve the problem that different market regimes need different approaches.
Where it's dangerous
Overfitted models sold with perfect backtest curves. An ONNX model can absolutely be trained to produce a beautiful equity curve on historical data. That doesn't mean it'll make a cent going forward. If the seller doesn't show walk-forward validation or out-of-sample testing, be skeptical. We wrote about the gap between backtest and live results specifically because this keeps catching people.
Models trained on leaked future data. If the training process accidentally includes information that wouldn't have been available at trading time (look-ahead bias), the model learns to cheat. Backtest looks incredible. Live trading is random. This is surprisingly easy to do wrong, even for experienced developers.
What we've actually seen
From testing ONNX EAs over the past year, three observations:
The models that worked best in live conditions were not the most complex ones. A well-tuned XGBoost with clean feature engineering beat a deep LSTM on several pairs we tested. The difference wasn't the model architecture. It was how carefully the training data was prepared and how strictly the train/test split was enforced.
Signal filtering consistently outperformed pure prediction. An EA with mediocre rules plus a good ONNX filter performed better than an EA with no rules and a sophisticated prediction model. The rules give it structure. The model decides which signals are worth taking.
Every model degraded over time. The ones that started strong needed retraining within 3-6 months. Markets change. A model trained on 2024 data doesn't know about the volatility regime that started in late 2025. If your ONNX EA doesn't have a retraining plan, it has an expiration date.
If you want to try it yourself
Prerequisites: Basic Python. Understanding of what overfitting is. Willingness to learn that your first model will probably not work.
Easiest starting point: MQL5's ONNX.Price.Prediction project. It includes a Python training script and a working EA. Open MetaEditor, find the project under Toolbox > Public Projects, and join it.
Don't want to train your own? You can use someone else's ONNX model. Just know that you're trusting their training process, their data splits, their validation. If they overfitted, you inherit that problem.
For the full picture of how ONNX fits into EA development, read the first two articles in this series: ONNX is changing how EAs are built and ONNX vs ChatGPT: two types of AI in trading.
The bottom line
An ONNX file is a math recipe learned from data. Whether it captured real patterns or memorized noise comes down to how carefully it was trained and tested. The tech part is straightforward. Getting the training right is where everyone fails.
About the author: The FXTool team builds and tests MetaTrader trading tools daily. We run every EA we sell on live accounts and publish the results. This guide reflects what we've learned from building 50+ EAs and working with thousands of retail traders.