Trading robot · MT5

Smart Grid Martingale EA

by chenhengyi53-design

This MetaTrader 5 expert advisor executes a grid trading strategy enhanced with martingale lot scaling.

High risk

GitHub stars9
Forks7
Last update9 months ago10 Feb 2026
LicenceNone stated

Overview

The system identifies market direction through multi-timeframe analysis using Exponential Moving Averages and the Average Directional Index. It features dynamic grid spacing that adjusts based on market volatility and a trend-aware entry filter. Risk management is handled through equity protection settings, maximum exposure limits, and a breakout recovery mechanism. The EA also supports an anti-martingale mode for compounding positions during favorable price movements.

Details

Author

chenhengyi53-design on GitHub

Type

Trading robot

Markets

Gold, Forex

Timeframes

M1-M5, M15-H1

Risk Profile

  • Uses martingale lot scaling: losses can grow fast
  • Opens a grid of orders: exposure builds up in a trend

Input Parameters

Read from 智能网格马丁EA_完美版_fixed.mq5. Defaults are the author's; change them in the EA's Inputs tab.

NameTypeDefaultDescription
CommentStrstringSmartGridMartingale订单注释
MagicNumberulong20241111魔术码
InitialLotdouble0.01初始手数
Slippageint3滑点
TestModebooltrue测试模式
EnableDebugLogbooltrue启用调试日志
EnableAlertsbooltrue启用警报
MaxGridLayersint15最大网格层数
GridDistancedouble40网格间距
DynamicGridbooltrue动态调整网格间距
GridMinDistancedouble25最小网格间距
GridMaxDistancedouble120最大网格间距
Show all 40 inputs
NameTypeDefaultDescription
GridTakeProfitdouble50网格止盈点数
MinTicksBetweenOrdersint3订单间最小tick数
ResetGridOnProfitbooltrue盈利后重置网格
MaxGridShiftdouble600最大网格偏移点数
EnableGridExpansionbooltrue启用网格扩展机制
GridExpansionFactordouble1.1网格扩展因子
MartingaleMultiplierdouble1.1马丁倍率
MaxMartingaleLayersint4最大马丁层级
LayerLossPercentdouble0.3触发加仓的亏损比例
SmartMartingalebooltrue智能马丁(趋势感知)
AntiMartingaleModebooltrue反马丁模式(盈利加仓)
ProfitMultiplierdouble1.2盈利加仓系数
EnableAdaptiveMartingalebooltrue启用自适应马丁格尔
MaxMartingaleExposuredouble0.2最大马丁格尔风险敞口(20%)
TrendTimeframeENUM_TIMEFRAMESPERIOD_H1趋势判断时间框架
MAPeriodint20移动平均线周期
MAMethodENUM_MA_METHODMODE_EMAMA计算方法
ADXPeriodint14ADX周期
ADXThresholddouble20ADX趋势阈值
TrendStrengthdouble0.8趋势强度系数
EnableMultiTimeframeAnalysisbooltrue启用多时间框架分析
SecondaryTimeframeENUM_TIMEFRAMESPERIOD_M30次要趋势判断时间框架
TrendConfirmationThresholddouble0.7趋势确认阈值
EnableBreakoutboolfalse启用突围机制
KeepLastLayersint2保留最后几层网格
BreakoutStopPercentdouble15触发突围的亏损百分比
SeedStopLossdouble200种子仓位止损点数
BreakoutTimeLimitint24突围时间限制(小时)

How to Install It

  1. 1Download the sourceUse "Download source (.zip)" above, or clone chenhengyi53-design/SmartGridMartingaleEA 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

Prem Gold Advisor

by Premkumar238
13 stars

Prem Gold Advisor is an automated MetaTrader 5 expert advisor specialized for XAUUSD (Gold) trading on the five-minute timeframe. It initiates trades using breakout levels placed at specific distances from the candle open. The strategy features a progressive scale-in mechanism, adding new orders as the price hits succe

MT5 Trading robot BreakoutTrend followingMartingale High risk
Updated 2 months ago None stated GitHub repository of Prem Gold Advisor

STO Martin

by crq644
3 stars

STO Martin is a grid-based trading robot for MetaTrader 5 that uses technical indicators to manage entries and recoveries. It employs a Stochastic Oscillator for execution signals and a Moving Average to filter trades according to the prevailing trend. The EA features a martingale lot-scaling system that adds positions

MT5 Trading robot MartingaleGridTrend following High risk
Updated 3 years ago None stated GitHub repository of STO Martin

Bot Trend

by uselinuxdev
3 stars

Bot Trend is a trend-following expert advisor for MetaTrader 5. It utilizes proprietary Francisca entry logic and manages trades through multiple concurrent execution threads. The system incorporates custom Zero Gravity step logic for position management and includes specific operational modes for Fridays and holidays.

MT5 Trading robot Trend followingGridMartingale High risk
Updated 9 months ago None stated GitHub repository of Bot Trend

IchiDCA CCBSN PropFirm EA

by magicniuniu
3 stars

IchiDCA CCBSN PropFirm EA is an automated trend-following robot for MetaTrader 5, optimized for gold and forex markets. It triggers trades based on Ichimoku Cloud breaks, filtered by dual Exponential Moving Averages and MACD indicators. The strategy manages positions through a Dollar Cost Averaging system that layers u

MT5 Trading robot Trend followingGridMean reversion High risk
2 stars

This Expert Advisor for MetaTrader 5 focuses on gold trading through a combination of mean-reversion signals and a grid management system. It uses multi-timeframe filters, including exponential moving averages and ADX on the H1 timeframe, to identify trend direction while executing entries on M15 based on RSI and Bolli

MT5 Trading robot Mean reversionGridMartingale High risk

Xauusd Auto Trader

by ibadnarpatih-create
2 stars

This MetaTrader 5 expert advisor is designed for trading XAUUSD using a trend-following approach. It identifies entries through a triple Exponential Moving Average crossover system, requiring ADX momentum confirmation before opening positions. To manage losing trades, the EA employs a martingale strategy that layers or

MT5 Trading robot Trend followingIndicator crossoverMartingale High risk
Updated 2 months ago GPL-3.0 GitHub repository of Xauusd Auto Trader

More gold EAs

Related on ForexR

Need a Broker for MT5?

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

Compare MT5 brokers