Trading robot · MT5

DBasket EA

by dinethlive

DBasket EA is a statistical arbitrage expert advisor for MetaTrader 5 that trades three-pair correlation baskets.

GitHub stars5
Forks3
Last update8 months ago27 Dec 2025
LicenceNone stated

Overview

DBasket EA identifies price divergences between related currency pairs using Z-score analysis and enters hedged three-leg positions expecting mean reversion. The system incorporates advanced statistical modules including an Augmented Dickey-Fuller cointegration filter and Ornstein-Uhlenbeck half-life calculations for exit timing. Risk controls feature fixed or ATR-weighted lot sizing, basket-level stop losses and take profits, maximum drawdown protection, and daily loss limits. It requires a hedging-enabled account and specific symbol sets like AUDNZD, AUDCAD, and NZDCAD.

Details

Author

dinethlive on GitHub

Type

Trading robot

Platform

MetaTrader 5 (MQL5)

Strategy

Mean reversion, Hedging

Markets

Forex

Timeframes

M15-H1

Risk profile

  • Holds opposite positions at once

Topics

basket-triangleexpert-advisorsmetatrader5mt5

Input parameters

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

NameTypeDefaultDescription
InpSymbolSuffixstringSymbol suffix (e.g., ".m", "_sb")
InpLookbackPeriodint250Lookback period (bars)
InpCacheUpdateSecint30Cache update interval (seconds)
InpZScoreEntrydouble2.5Entry Z-Score threshold
InpZScoreExitdouble0.5Exit Z-Score threshold
InpMinCorrelationdouble0.75Minimum correlation threshold
InpMaxSpreadPipsdouble3.0Maximum spread (pips per symbol)
InpFixedLotSizedouble0.01Fixed lot size per leg
InpRiskPercentdouble1.0Risk % per basket (if dynamic sizing)
InpUseFixedLotsbooltrueUse fixed lot size
InpMaxDrawdownPctdouble15.0Max drawdown % before halt
InpDailyLossLimitdouble100.0Daily loss limit ($)
Show all 39 inputs
NameTypeDefaultDescription
InpDailyLossPctdouble5.0Daily loss limit (%)
InpMaxHoldingHoursint24Maximum basket holding hours
InpTakeProfitAmountdouble10.0Take profit per basket ($)
InpStopLossAmountdouble15.0Stop loss per basket ($)
InpCointEnabledbooltrueEnable Cointegration Filter?
InpCointPValuedouble0.05P-Value Threshold (0.01-0.10)
InpCointUpdateBarsint50Update Interval (bars)
InpCointADFLagsint1ADF Regression Lags
InpHLEnabledbooltrueEnable Half-Life Exits?
InpHLUpdateBarsint20Update Interval (bars)
InpHLMinValueint10Minimum Half-Life (bars)
InpHLMaxValueint500Maximum Half-Life (bars)
InpHLExitMultiplierdouble2.0Max Hold = Multiplier × HalfLife
InpHLStopLossSigmadouble1.5Stop-Loss Distance (sigma)
InpATREnabledbooltrueEnable ATR Sizing?
InpATRPeriodint14ATR Period
InpATRMinWeightdouble0.15Minimum Weight per Symbol
InpATRMaxWeightdouble0.50Maximum Weight per Symbol
InpTradingStartHourint0Trading start hour (broker time)
InpTradingStartMinint0Trading start minute
InpTradingEndHourint23Trading end hour (broker time)
InpTradingEndMinint59Trading end minute
InpAvoidRolloverbooltrueAvoid rollover period
InpMagicNumberint200000Magic number (v2.0)
InpSlippagePointsint10Maximum slippage (points)
InpLogLevelENUM_LOG_LEVELLOG_LEVEL_INFOLog level
InpLogToFileboolfalseLog to file

How to install it

  1. 1Download the sourceUse "Download source (.zip)" above, or clone dinethlive/dbasket-EA 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, and any .mqh files into the Include folder the code expects.
  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

8 stars

High Frequency Grid EA is an automated trading robot for MetaTrader 5 that implements a mean-reversion strategy through a grid of pending orders. It places buy and sell stop orders at calculated distances, using dynamic spread monitoring to ensure execution only during favorable conditions. The EA includes a trailing s

MT5 Trading robot GridMean reversionScalping High risk

Make Money EA

by lukeewu
4 stars

This MetaTrader 5 expert advisor implements a mean-reversion strategy primarily designed for the EUR/USD pair. It utilizes a 25-period Moving Average to identify price deviations, operating on the theory that hourly prices will eventually return to the mean. The code facilitates a dual-position approach, managing simul

MT5 Trading robot Mean reversionHedging
Updated 7 years ago None stated GitHub repository of Make Money EA
3 stars

This expert advisor facilitates arbitrage trading between futures and spot instruments, primarily targeting gold and stock indices. Available for MetaTrader 4 and 5, it monitors the price difference between two related symbols against a moving average to identify trade opportunities. The logic includes a noise-filterin

MT4MT5 Trading robot ArbitrageMean reversionGrid High risk
Updated 3 years ago None stated GitHub repository of Gold Futures Spot Arbitrage

AW Full Recovery EA

by wongthep
2 stars

This MetaTrader 5 expert advisor functions as a grid-based recovery system that can operate independently or manage trades from external EAs via magic number filtering. It initiates entries using Bollinger Bands and RSI indicators, then manages drawdown through a recovery grid matrix. The system employs dynamic ATR-bas

MT5 Trading robot GridMartingaleHedging High risk
Updated 3 months ago None stated GitHub repository of AW Full Recovery EA

Advanced Grid Trading

by jepli-1225
2 stars

Advanced Grid Trading is a MetaTrader 5 expert advisor that manages a complex grid strategy across four configurable layers. It places stop and limit orders at fixed intervals, employing either fixed or geometric lot scaling for increased grid depth. Trade management includes a shared profit pool used to close losing p

MT5 Trading robot GridMartingaleMean reversion High risk
Updated 6 months ago None stated GitHub repository of Advanced Grid Trading
2 stars

This MetaTrader 5 expert advisor implements a multi-layered grid strategy that manages up to three independent grids simultaneously on a single instrument. It uses the Relative Strength Index (RSI) across different timeframes to determine the initial trade direction for each grid. The EA employs martingale lot scaling,

MT5 Trading robot GridMartingaleMean reversion High risk
Updated 2 years ago None stated GitHub repository of Springfield 3 Grids

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