EA-47584 · Martingale

Martingale Trade Simulator

A Strategy Tester-only EA that provides a manual trading panel with Buy/Sell buttons and optional Martingale averaging and trailing stop features. When martingale is enabled, it opens additional positions with multiplied lot sizes at fixed pip intervals against the losing direction, then adjusts all positions' TP to the volume-weighted average price plus a profit target. The trailing stop feature moves SL to lock in profits when only one position exists per direction.

Open the interactive view (equity curve, symbol switch)

Key facts

CategoryMartingale
RiskDangerous
Blow-up riskElevated
Rating★☆☆☆☆
TypeTrading EA
TimeframesM15, H1, H4
IndicatorsNone
Authordrdz9876@gmail.com

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 EA implements a classic Martingale averaging strategy: after an initial manual entry, if price moves against the position by StepPips, it opens an additional position with lot size multiplied by nextLot, thereby shifting the volume-weighted average price closer to current price so that all positions can profitably close at the average price plus TPPlus. Entry conditions are entirely manual—the user clicks Buy or Sell buttons on the tester panel, with no automated signal generation. Exit conditions include the original SL/TP, the martingale-adjusted unified TP (weighted average price ± TPPlus), and an optional trailing stop that only activates when exactly one position exists per direction. Position sizing uses exponential growth: the Nth additional lot equals the smallest position's lot times nextLot^N, normalized by lotAdjust to conform to broker volume constraints. Money management only checks whether free margin suffices for the next trade via CheckMoneyForTrade, lacking any maximum position count, total volume cap, or drawdown protection—making the exponential lot growth extremely dangerous during sustained adverse moves.

Strengths

  • Provides a visual tester panel for convenient manual trade simulation in the Strategy Tester
  • The martingale averaging logic accounts for swap and commission corrections in the weighted average price calculation, which is relatively precise
  • The trailing stop distinguishes between initial stop-loss movement and profit-locked trailing, with relatively complete logic
  • The lotAdjust function correctly normalizes lot sizes to broker step, min, and max constraints

Weaknesses

  • The martingale strategy is inherently high-risk; exponential lot growth during consecutive losses can easily blow the account, with no maximum position or lot cap protection
  • The trailing stop only activates when exactly one position exists per direction—completely disabled during martingale's multi-position scenarios, creating a logical contradiction
  • The modifyAllSLTP function returns after the first successful modification, leaving remaining positions potentially unmodified with incorrect TP/SL
  • Magic number is hardcoded to 0, making it impossible to distinguish this EA's positions from other EAs or manual trades, risking unintended operations
  • Only runs in Strategy Tester visual mode, cannot be used for live trading or pure optimization runs

Possible improvements

  • Add maximum position count and total volume caps to prevent unlimited martingale scaling that leads to account blowup
  • Fix modifyAllSLTP to iterate and modify all positions of the same type before returning, instead of returning after the first successful modification
  • Use a non-zero magic number to distinguish this EA's positions, and allow operation in non-visual tester modes
  • Extend trailing stop to support multi-position scenarios, or at minimum provide an equity-based overall stop mechanism when multiple positions are open

Risk assessment

Overall risk: Dangerous

  • Martingale strategy with exponential lot growth and no maximum position/lot cap guarantees account blowup in extreme market conditions
  • Trailing stop is completely disabled during multi-position martingale scenarios, leaving no dynamic stop protection after averaging orders are placed
  • Magic number of zero risks unintended modifications to positions from other EAs or manual trades
  • modifyAllSLTP only modifies the first position then returns, causing inconsistent TP/SL across the position group

Evaluation scores

Code quality2.0
Strategy logic2.0
Risk management1.0
Robustness1.0
Innovation2.0
Documentation1.0
Overall1.5

Parameters

ParameterDefaultDescription
Lots0.01Initial lot size
StopLoss500Stop loss in points
TakeProfit500Take profit in points
TrailingStop50Trailing stop in points
TrailingStep20Trailing step in points
nextLot1.2Martingale lot multiplier
StepPips150Position addition distance in points
TPPlus50Additional TP points on martingale average price

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.