Trading robot · MT5

XGBoost Classifier MT5

by alexandruchirita4192

This MetaTrader 5 expert advisor utilizes an XGBoost machine learning model exported via the ONNX format to identify trading opportunities.

GitHub stars1
Forks0
Last update5 months ago19 Apr 2026
LicenceGPL-3.0

Overview

XGBoost Classifier MT5 enters trades based on classification probabilities and a minimum gap between prediction classes. The system features extensive risk controls, including stop loss and take profit levels calculated via Average True Range multiples. Additional filters include a trend-following EMA check on higher timeframes and a volatility filter based on ATR percentiles. It also incorporates a kill switch mechanism that monitors recent performance to automatically pause trading during periods of low win rates.

Details

Author

alexandruchirita4192 on GitHub

Type

Trading robot

Platform

MetaTrader 5 (MQL5)

Strategy

AI / machine learning, Trend following

Markets

Any symbol

Timeframes

Any timeframe

Risk profile

No grid, martingale or hedging logic was found in its code or README. That says nothing about how it performs: backtest it first.

Input parameters

Read from MT5_XGBoost_Classifier_ONNX_Strategy.mq5. Defaults are the author's; change them in the EA's Inputs tab.

NameTypeDefaultDescription
InpLotsdouble0.10InpLots: Fixed lot
InpEntryProbThresholddouble0.60InpEntryProbThreshold: Minimum probability threshold for BUY/SELL
InpMinProbGapdouble0.15InpMinProbGap: Minimum difference between the best class and the next one
InpUseAtrStopsbooltrueInpUseAtrStops: Use SL/TP based on ATR
InpStopAtrMultipledouble1.50InpStopAtrMultiple: SL = ATR * multiplier
InpTakeAtrMultipledouble2.00InpTakeAtrMultiple: TP = ATR * multiplier
InpMaxBarsInTradeint8InpMaxBarsInTrade: Recommended to match horizon_bars from Python
InpCloseOnOppositeSignalbooltrueInpCloseOnOppositeSignal: Close on opposite signal
InpAllowLongbooltrueInpAllowLong: Allow BUY
InpAllowShortbooltrueInpAllowShort: Allow SELL
InpUseTrendFilterbooltrueInpUseTrendFilter: Enable trend filter
InpTrendTFENUM_TIMEFRAMESPERIOD_H1InpTrendTF: Trend timeframe
Show all 30 inputs
NameTypeDefaultDescription
InpTrendMAPeriodint100InpTrendMAPeriod: EMA period
InpTrendRequireSlopebooltrueInpTrendRequireSlope: EMA must also have slope in signal direction
InpUseTrendDistanceFilterboolfalseInpUseTrendDistanceFilter: Require minimum distance from HTF EMA
InpTrendMinDistancePctdouble0.0010InpTrendMinDistancePct: Minimum distance from EMA (0.001 = 0.1%)
InpUseAtrVolFilterbooltrueInpUseAtrVolFilter: Enable ATR filter
InpAtrVolLookbackint50InpAtrVolLookback: Number of bars for ATR distribution
InpAtrMinPercentiledouble0.25InpAtrMinPercentile: Minimum ATR percentile in distribution (0..1)
InpAtrMaxPercentiledouble0.85InpAtrMaxPercentile: Maximum ATR percentile in distribution (0..1)
InpUseKillSwitchboolfalseInpUseKillSwitch: Enable kill switch
InpKillSwitchLookbackTradesint8InpKillSwitchLookbackTrades: Last N trades analyzed
InpKillSwitchMinWinRatedouble0.40InpKillSwitchMinWinRate: Minimum accepted win rate
InpKillSwitchMinProfitFactordouble0.95InpKillSwitchMinProfitFactor: Minimum accepted profit factor
InpKillSwitchConsecutiveLossesint4InpKillSwitchConsecutiveLosses: Maximum consecutive losses
InpKillSwitchPauseBarsint96InpKillSwitchPauseBars: Pause in bars after activation
InpKillSwitchFlatOnActivatebooltrueInpKillSwitchFlatOnActivate: Close the current position when activated
InpMagiclong26042026InpMagic: Magic number
InpLogboolfalseInpLog: Main log
InpDebugLogboolfalseInpDebugLog: Log on every new bar

How to install it

  1. 1Download the sourceUse "Download source (.zip)" above, or clone alexandruchirita4192/XGBoostClassifierMT5 from GitHub, and unzip it.
  2. 2Open the data folderIn MetaTrader choose File, then Open Data Folder, and go to MQL5/Experts.
  3. 3Copy the filesCopy the .mq5 file into Experts.
  4. 4Compile in MetaEditorOpen the file in MetaEditor and press Compile. Fix any missing includes the compiler reports.
  5. 5Test before you tradeRun it in the Strategy Tester, then attach it to a demo chart and allow algorithmic trading.
Third-party code. ForexR did not write, test or endorse this EA, and the summary above was generated automatically from its README and code. ForexR lists only repositories with readable source code and never hosts files. Read the code, backtest it and use a demo account first; automated trading can lose money quickly.

Similar expert advisors

FxChartAI OpenEA

by abiodunaremu
49 stars

FxChartAI OpenEA is an automated trading solution for MetaTrader 5 that executes trades based on signals retrieved from the FxChartAI platform. The system operates in two modes, allowing for live API integration or historical testing using CSV datasets. It utilizes multi-timeframe analysis across M10 and H1 intervals,

MT5 Trading robot AI / machine learningTrend following
Updated 1 year ago GPL-3.0 GitHub repository of FxChartAI OpenEA
42 stars

This Expert Advisor for MetaTrader 5 is specifically designed for XAUUSD trading on the M1 timeframe. It utilizes a hybrid strategy combining classic technical indicators like RSI, Moving Averages, and ATR with an OpenAI API integration for signal validation. The robot features an on-chart dashboard for telemetry and i

MT5 Trading robot ScalpingTrend followingAI / machine learning
Updated 5 months ago None stated GitHub repository of Gold EA MT5 With OpenAI

AI Enhanced HFT

by Marco210210
20 stars

This MetaTrader 5 expert advisor combines technical indicators with machine learning forecasts to trade the Forex market. It uses a trend-following approach based on Exponential Moving Average crossovers, filtered by the Average Directional Index and volume confirmations. A unique feature is its integration with extern

MT5 Trading robot Trend followingIndicator crossoverAI / machine learning High risk
Updated 1 year ago None stated GitHub repository of AI Enhanced HFT

Code To Cash

by LUBANGAKENE
9 stars

Code To Cash is an end-to-end algorithmic trading system for MetaTrader 5 that combines deep learning forecasts with technical breakout logic. It utilizes a ZeroMQ bridge to receive real-time market predictions from an external Python backend. The system enters trades using BuyStop or SellStop orders at recent price ex

MT5 Trading robot AI / machine learningBreakoutTrend following
Updated 1 year ago None stated GitHub repository of Code To Cash
6 stars

This MetaTrader 5 expert advisor provides a versatile framework for trading based on Heiken Ashi price action. It allows users to toggle between numerous built-in strategies, including trend following, moving average crossovers, Fibonacci levels, and various oscillators like RSI and MACD. The system includes an option

MT5 Trading robot Trend followingIndicator crossoverMean reversion
Updated 2 years ago None stated GitHub repository of Heiken Ashi Complete Strats

MarketSync EA

by sajidmahamud835
6 stars

MarketSync EA is an experimental MetaTrader 5 expert advisor designed to bridge algorithmic trading with external artificial intelligence. It functions by streaming real-time market and account data from the MT5 terminal to a local Node.js backend via HTTP requests. The external server processes this information using

MT5 Trading robot AI / machine learningGridTrend following High risk
Updated 8 months ago MIT GitHub repository of MarketSync EA

More trading robots

Need a broker for MT5?

Compare regulated brokers that support MetaTrader, with spreads, minimum deposits and leverage side by side.

Compare brokers