EA-45595 · Martingale

UnityMartingale

A multi-currency expert advisor that uses the Unity indicator to detect overbought/oversold currency conditions and trades with a martingale lot-sizing strategy. It supports both breakout and pullback signal modes, includes trailing stop functionality, scheduled trading hours, and a sophisticated optimization reporting system with R-squared criterion. The EA can simultaneously manage multiple currency pairs through a strategy pool architecture.

Open the interactive view (equity curve, symbol switch)

Key facts

CategoryMartingale
RiskDangerous
Blow-up riskElevated
Rating★★★☆☆
TypeTrading EA
TimeframesM15, H1, H4, D1
IndicatorsUnity Percent Event, EMA
Author—

Backtest results (H1, about 1 year)

SymbolP&LAnnualMax DDTradesWin rateSharpeRecoveryLosing streakPer tradeStatus
EURUSD0.00%0.00%0.00%0—————Not convertible yet
GBPUSD0.00%0.00%0.00%0—————Not convertible yet
USDJPY0.00%0.00%0.00%0—————Not convertible yet
XAUUSD0.00%0.00%0.00%0—————Not convertible yet

Why this EA never traded: no entry rule survived the conversion.

Converted from MQL5 to Python and run with the same rules for every EA. Positions use MT5 lot sizes (100,000 units per FX lot, 100 oz per gold lot) with 1:100 leverage, one order at a time, and a stop-out below 10% of the starting balance. Sharpe is computed from the equity curve. Results marked as unreliable are shown for completeness only.

Blow-up risk: Elevated

  • Increases the position size after losses (martingale)

High: stopped out in our backtest, or martingale/grid sizing without a stop loss. Elevated: martingale or grid sizing with a stop loss, or several positions at once without a stop loss. What the label means and what we found →

Strategy analysis

The strategy is based on the Unity indicator's multi-currency relative strength analysis, generating trade signals when one currency is at the maximum (overbought) and another at the minimum (oversold) among the indicator buffers. Entry conditions come in two modes: BREAKOUT mode enters in the signal direction directly, while PULLBACK mode reverses the signal direction, trading against the extreme. Exit conditions include stop loss/take profit triggers, position closure on opposing signals, and forced closure when outside scheduled trading hours. Position sizing employs a martingale strategy: after a profit, lot size resets to the base lots; after a loss, the lot is multiplied by the Factor, continuing until the Limit of multiplications is reached, at which point it resets to base lots. Money management includes free margin checks that automatically fall back to base lots when margin is insufficient, and a pause mechanism after trade errors based on the SkipTimeOnError timeout. The system also supports TrailingStop functionality and calculates equity drawdown on-the-fly in the tester to evaluate strategy performance.

Strengths

  • Excellent multi-currency architecture with a strategy pool that can manage multiple symbol instances simultaneously
  • Comprehensive optimization reporting system with R-squared criterion and HTML report generation for strategy evaluation
  • Clean code structure using OOP design (interfaces, inheritance, smart pointers) for high maintainability

Weaknesses

  • Martingale position sizing creates exponential risk growth during consecutive losses, potentially leading to account blowup
  • When multiple positions are detected, only an alert is issued without handling them, leaving a position management gap
  • The WorkSymbols parser's use of '-' symbol may conflict with negative numbers, reducing parsing robustness

Possible improvements

  • Add maximum drawdown limits or account equity protection that forces trading stop and position closure at dangerous levels
  • Replace martingale with anti-martingale or fixed fractional position sizing to reduce risk exposure during losing streaks

Risk assessment

Overall risk: Dangerous

  • Martingale lot doubling creates exponential growth - Factor=2 and Limit=5 means max lot can reach 32x the initial size
  • Although Limit caps the number of multiplications, a single max-lot trade can still cause catastrophic loss
  • Running martingale on multiple correlated symbols simultaneously may trigger doubling across all pairs at once

Evaluation scores

Code quality4.0
Strategy logic3.0
Risk management2.0
Robustness3.0
Innovation4.0
Documentation3.0
Overall3.2

Parameters

ParameterDefaultDescription
UseTimetrueEnable trading session restrictions
HourStart2Trading start hour(0-23)
HourEnd22Trading end hour(0-23)
Lots0.01Initial lot size
Factor2.0Martingale multiplier factor
Limit5Maximum doubling count
StopLoss500Stop loss in points
TakeProfit500Take profit in points
StartType0Signal type: 0=breakout, 1=pullback
Magic1234567890Magic number to identify this EA's positions
SkipTimeOnError1Pause duration after trade error
TrailingtrueEnable trailing stop
WorkSymbolsCustom trading symbols string
UnitySymbolsEURUSD,GBPUSD,USDCHF,USDJPY,AUDUSD,USDCAD,NZDUSDCurrency pair list for Unity indicator
UnityBarLimit10Bar limit for Unity indicator
UnityPriceTypePRICE_CLOSEUnityindicatorprice type
UnityPriceMethodMODE_EMAUnityindicatorMA method
UnityPricePeriod1Unityindicator MA period

Similar Martingale EAs

Backtests are historical simulations and do not guarantee future results. Not financial advice.

Get the weekly Arena report

One email a week: ranking changes, new signals and new research. No spam; unsubscribe any time.