Trading robot · MT5

Bi-Directional Hedging Grid

by Yoshinarium

This MetaTrader 5 expert advisor implements a dual-direction hedging grid strategy primarily designed for XAUUSD.

High risk

GitHub stars1
Forks0
Last update2 months ago17 Aug 2026
LicenceNone stated
Latest releasev2.2.02 months ago

Overview

Bi-Directional Hedging Grid simultaneously maintains buy and sell baskets, opening new positions at fixed or ATR-calculated intervals when the market moves against existing trades. The EA employs a soft martingale lot multiplier to scale positions and exits through either individual take profit targets or a collective basket profit in currency. It includes prop-firm oriented risk controls such as equity-based daily drawdown limits, spread filters, rollover pauses, and automated weekend closures.

Details

Author

Yoshinarium on GitHub

Type

Trading robot

Markets

Gold

Timeframes

M15-H1

Risk Profile

  • Uses martingale lot scaling: losses can grow fast
  • Opens a grid of orders: exposure builds up in a trend
  • Holds opposite positions at once
  • Trades without a fixed stop loss

Input Parameters

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

NameTypeDefaultDescription
MagicNumberBuyint1000Magic Number koszyka BUY
MagicNumberSellint2000Magic Number koszyka SELL
BaseLotdouble0.01Lot pozycji startowej
GridModeENUM_GRID_MODEFIXED_POINTSTryb odleglosci siatki
FixedGridPointsint100Krok siatki w punktach (gdy FIXED_POINTS)
AtrPeriodint14Okres ATR (gdy ATR_MODE)
AtrMultiplierdouble1.5Mnoznik ATR (gdy ATR_MODE)
LotMultiplierdouble1.3Soft Martingale: lot = ostatni lot * mnoznik
BaseTakeProfitPointsint200TP pojedynczej bazy w punktach (_Point)
BasketProfitTarget_USDdouble0.5Cel zysku KOSZYKA (od 2. nogi) w walucie depozytu
UseDailyDrawdownbooltrueWlacz dzienny limit drawdown
MaxDailyDrawdownPercentdouble4.5Max DD % od equity z 00:00 czasu serwera
Show all 18 inputs
NameTypeDefaultDescription
MaxSpreadPointsint30Max spread w punktach (_Point)
UseMidnightPausebooltruePauza na rollover (brak NOWYCH zlecen)
PauseStartTimestring23:55Poczatek pauzy (HH:MM)
PauseEndTimestring00:15Koniec pauzy (HH:MM)
CloseBeforeWeekendbooltrueZamknij wszystko w piatek i uspij do poniedzialku
FridayCloseTimestring22:00Godzina zamkniecia w piatek (HH:MM)

How to Install It

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

AutoTrade EA

by liucheng-12-08
3 stars

AutoTrade EA is a scalping robot for MetaTrader 4 and 5 that utilizes a multi-indicator signal scoring system based on Exponential Moving Average crossovers and RSI levels. It employs an aggressive trade management strategy featuring a dynamic grid and a stepped martingale lot scaling system where position sizes increa

MT4MT5 Trading robot ScalpingIndicator crossoverMartingale High risk
Updated 8 months ago None stated GitHub repository of AutoTrade EA

Grid Hedge Combine

by Far-1d
3 stars

Grid Hedge Combine is a MetaTrader 5 expert advisor designed to automate market entries using a mixture of grid and hedging techniques. It opens initial trades and layers subsequent orders at predefined pip intervals when the price moves against the position. The EA features lot size scaling, allowing for aggressive or

MT5 Trading robot GridMartingaleHedging High risk
Updated 2 years ago None stated GitHub repository of Grid Hedge Combine
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

Mr X Grid Hedge

by ibrahimzameel9232-lgtm
2 stars

Mr X Grid Hedge is a MetaTrader 5 expert advisor specifically designed for XAUUSD trading. It utilizes a grid strategy with entry signals confirmed by a combination of EMA crossovers, RSI bounds, and ATR volatility filters. The system manages risk through automated hedging triggered by drawdown or specific grid depth.

MT5 Trading robot GridMartingaleHedging High risk
Updated 12 months ago None stated GitHub repository of Mr X Grid Hedge

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