ONNX model research pipeline in MQL5
Learn how ONNX fits into an MT5 research workflow while keeping models observe-only until data, validation, and risk controls survive audit.
Lesson outcomes
- Understand the role of ONNX model loading and inference in MQL5.
- Design a safe research pipeline from notebook to observe-only EA.
- Avoid treating model output as a trade signal without validation.
Workshop lab
Complete the demo, notebook, platform, or code task before treating the lesson as finished.
Evidence pack
Keep screenshots, exports, logs, calculations, or code versions in a dated learning folder.
Pass standard
You should be able to explain the failure modes, show your work, and name the stop rule.
Free education, not signals. This lesson is part of EarnSouthAfrica's free forex course. It does not tell you what to buy or sell, it does not promise income, and it should be practised on a demo account before any real-money decision.
ONNX support makes it possible to bring trained models into an MQL5 workflow, but that does not make the model good. A weak dataset plus ONNX is still a weak system. A serious course teaches the interface, then surrounds it with validation and risk boundaries.
This lesson is an advanced research bridge: define the model target, train outside or alongside MT5, export to ONNX, load it, run inference, log outputs, and keep trading disabled until the evidence survives walk-forward testing.
What you should be able to do after this lesson
- Understand the role of ONNX model loading and inference in MQL5.
- Design a safe research pipeline from notebook to observe-only EA.
- Avoid treating model output as a trade signal without validation.
Research pipeline
| Stage | Evidence |
|---|---|
| Dataset | Rates/ticks source, broker, symbol, timeframe, features, labels, costs, and leakage checks. |
| Training | Model version, training window, validation window, metrics, rejected variants, and feature ablation. |
| ONNX export | Input shape, output meaning, normalization rules, and version checksum. |
| MQL5 inference | Load result, input preparation, model output, error handling, and observe-only log. |
Observe-only boundary
- First integration logs model output without opening, closing, or modifying trades.
- Predictions must be timestamped with feature values and market context.
- The EA must record when model input is unavailable, stale, or outside expected ranges.
- Only after validation can the model become one filter inside a broader risk system.
ONNX smoke test
The first demo exercise is a smoke test: load a model, prepare one known input row, run inference, and compare the output to the notebook result. If the values differ, fix preprocessing before discussing market performance.
Academy-grade study plan
Machine learning in trading is not a shortcut around market uncertainty. The paid-course standard is to prove data integrity, prevent leakage, respect non-stationarity, validate outside the fitting window, and keep ML outputs behind strict demo-only risk boundaries.
| Course element | What you must produce |
|---|---|
| Primary artifact | Model research dossier |
| Lesson focus | ONNX model research pipeline in MQL5 |
| Working environment | Demo account, notebook, exported platform data, or local code sandbox. Never live funds for first practice. |
| Completion standard | You can explain the concept, reproduce the exercise, identify failure modes, and show evidence without relying on a seller's claims. |
Instructor workflow
Use this workflow as if an instructor were marking the lesson. The important question is not whether the topic sounds familiar. The question is whether your notes, screenshots, calculations, logs, or code prove that you can apply onnx model research pipeline in mql5 under controlled conditions.
- Define the prediction target, horizon, features, labels, costs, and no-trade conditions before any model run.
- Build a data lineage record from MT5 rates, ticks, custom symbols, calendar data, feature engineering, training window, validation window, and deployment boundary.
- Use walk-forward validation, cost stress, feature-ablation tests, and regime checks before trusting any metric.
- Treat ONNX integration as an engineering interface for research models, not evidence that the model has an edge.
Worked case study: A model looks brilliant because it leaked the future
A learner trains a model that predicts the next candle with impressive accuracy. The audit discovers that features used values only known after the prediction point, spreads were ignored, and the validation data overlapped with the tuning process. The professional response is to discard the result, rebuild the dataset, and require walk-forward evidence before any demo automation.
After reading the scenario, write the decision you would make before checking the suggested workflow above. Then compare your decision with the operating model. The gap between those two answers is the part of the lesson that deserves another demo repetition.
Professional template
Complete this template in your own notebook. A paid course would normally hide this kind of operating document behind worksheets; here it is part of the free lesson.
| Field | Standard |
|---|---|
| Dataset | Symbol, timeframe, broker, date range, tick/rate source, timezone, missing data, and cleaning checks. |
| Feature set | Inputs available at decision time, transformations, lookback windows, and leakage controls. |
| Validation | Train/validation/test split, walk-forward windows, costs, slippage, feature ablation, and rejection threshold. |
| Deployment boundary | Observe-only, demo-only, max risk, kill switch, logging, and retraining/version rule. |
Failure-mode lab
Paid courses often sell confidence. A serious course teaches you how the idea breaks. Before continuing, test the failure modes below on demo, paper, or code review. If you cannot describe the failure, you are not ready to trust the concept.
- Using future candle values, final high/low, revised labels, or post-trade information as model inputs.
- Optimizing features until one historical period looks good while out-of-sample behaviour collapses.
- Ignoring spread, commission, slippage, swap, rollover, and execution delay.
- Moving a model from notebook to EA before the data, validation, and risk boundaries are documented.
Evidence pack and pass standard
Do not mark this lesson complete because you read it. Mark it complete only when you can show the evidence below. Keep the files in a dated folder so your learning history survives platform updates, memory gaps, and sales pressure.
- A one-page note explaining onnx model research pipeline in mql5 without sales language or copied definitions.
- A screenshot, export, calculation, log, or code file that proves the practical work was completed on demo.
- A written stop rule that says when this topic must not be used with real money.
- A research notebook or report with data lineage, leakage checks, walk-forward results, and rejected models.
- An observe-only model log showing predictions, feature values, decision boundaries, and no-trade reasons.
Assessment rubric
| Level | What it looks like |
|---|---|
| Not ready | You can repeat the vocabulary but cannot complete the demo task, calculate the risk, explain the failure mode, or show evidence. |
| Course pass | You can complete the practical task on demo, explain the decision rules, show evidence, and name the conditions where the idea must not be used. |
| Strong pass | You can teach the concept to someone else, find edge cases, document a rejected example, and improve the template without weakening risk controls. |
Advanced homework
- Break a promising model by shifting labels one bar forward and proving why the original result was invalid.
- Run feature ablation to see whether the model depends on one unstable input.
- Build an ONNX smoke test that logs model output on demo without sending any orders.
Practical drill
Do this lesson as a controlled exercise, not as a reason to trade live. Open a demo account or notebook, write the lesson title, and record what you changed, clicked, calculated, or checked. If the lesson includes code, compile it only in a demo environment and keep the original version unchanged so you can compare edits safely.
- Write a one-paragraph explanation of onnx model research pipeline in mql5 in your own words.
- Take one screenshot or note that proves you completed the platform, maths, research, or code task.
- Record one risk rule that would stop you from using this idea with real money.
- If anything feels unclear, repeat the lesson before moving to the next module.
How scammers misuse this topic
Scammers often take real concepts and wrap them in urgency. They may use platform jargon, bot screenshots, copied profit charts, or official-sounding language to make a paid offer feel safe. A real concept is not the same as a safe offer. Before paying anyone, ask whether you can verify the provider, reproduce the calculation, test the claim on demo, understand the risk, and walk away without pressure.
Checkpoint before continuing
- You can explain what the ONNX model input and output represent.
- Your integration begins in observe-only mode.
- Your preprocessing in MQL5 matches the research notebook.
Official references
These lessons are written as free education. When platform features or rules matter, verify against the official source before using real money.
Risk note: leveraged forex and contracts for difference can lose money quickly. EarnSouthAfrica is an educational publisher, not a broker, adviser, signal provider, or money manager.
Keep exploring
Read the latest guides, take the side-hustle quiz, or contact the editorial desk if you spot a correction.