You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Integrating AI into 3 Smart Money Concepts (SMC): OB, BOS, and FVG.
This guide integrates a trained XGBoost model (ONNX) into an SMC EA to evaluate trade setups before execution. The Python pipeline labels historical XAUUSD events and produces a 12-feature representation aligned with the EA. The result is a reproducible method to train, export, and embed the model so the EA can filter OB, FVG, and BOS signals programmatically.
The system is built on two separate but tightly connected layers. The first layer is a Python training pipeline. It fetches OHLCV data from MetaTrader 5, detects SMC signals, labels each event as a win/loss based on TP/SL, and trains an XGBoost classifier on the resulting dataset. Once training is complete, the model is exported to ONNX format and saved directly into the MetaTrader 5 Files folder. From there, MetaEditor compiles it into the EA as a binary resource, meaning the model is baked into the executable and requires no file path at runtime.
The second layer is the MQL5 EA itself, which handles everything that happens on the chart. On each new bar, it scans for valid OB, FVG, and BOS setups using the same detection logic that was used during training. When price enters a zone, the EA builds a feature vector from the current market context and passes it to the embedded ONNX model for scoring. If the score meets the minimum confidence threshold, the trade is executed with a volatility-aware stop-loss and take-profit. A trailing stop then manages the open position tick by tick, locking in profit as price moves forward. The chart panel displays the active signal, its origin, the AI confidence score, and the current trend strength. This provides visibility into the system's decisions.
Author: Hlomohang John Borotho