EA-1160 · Martingale

20_200 expert_v4.2_AntS

This EA compares open prices of two bars at configurable shifts and opens a buy or sell position when the price difference exceeds a threshold. It employs a martingale-style lot multiplication after losses and uses a fixed trading hour for entries. Positions are closed by take-profit, stop-loss, or a maximum holding time.

Open the interactive view (equity curve, symbol switch)

Key facts

CategoryMartingale
RiskHigh risk
Blow-up riskElevated
Rating★★☆☆☆
TypeTrading EA
TimeframesH1, H4, D1
IndicatorsPrice Action (Bar Open Comparison)
AuthorInteger

Backtest results (H1, about 1 year)

Not backtested yet — this EA could not be converted automatically.

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 concept is based on comparing the open prices of two bars at configurable shifts (t1 and t2): a buy signal triggers when the second bar's open price exceeds the first bar's by more than Delta_L points, and a sell signal triggers when the first bar's open exceeds the second by more than Delta_S points. Entry conditions also restrict trading to a specific hour of the day (TradeTime) and require no existing position. Exit conditions include fixed take-profit and stop-loss in points, plus a forced close after MaxOpenTime hours. Position sizing offers both fixed lots and an auto-lot mode that scales with account balance via a hard-coded lookup table. Money management employs a martingale approach: when the recorded balance from the last trade exceeds the current balance (indicating a loss), the lot size is multiplied by BigLotSize. The OneMult parameter controls whether the multiplied lot is used once or repeatedly for each new position until profit. The LotSize function is an extremely long if-else chain mapping balance from 300 to 273580 to lot sizes from 0.01 to 10.00, with no mathematical formula used.

Strengths

  • Clear stop-loss and take-profit settings with defined point values, making risk parameters transparent
  • Maximum holding time limit prevents indefinite position trapping
  • Uses global variables to track last balance for loss detection, persisting state across EA restarts

Weaknesses

  • Martingale strategy causes exponential lot growth on consecutive losses, potentially leading to account blowup
  • LotSize function uses nearly 1000 lines of hard-coded if-else statements, extremely difficult to maintain and error-prone
  • SignalOpenSell has unreachable return(false) on line 190 — dead code bug
  • Only trades during one specific hour per day, severely limiting opportunities with no multi-session validation
  • No spread filter, which can erode profits especially with relatively small take-profit values

Possible improvements

  • Replace the 1000-line if-else ladder in LotSize with a mathematical formula for maintainability
  • Add spread filter and slippage protection to avoid entering during high-spread periods
  • Add a maximum consecutive loss count limit to prevent infinite martingale lot escalation

Risk assessment

Overall risk: High risk

  • Martingale lot multiplication (BigLotSize=6) amplifies lot size 6x after each loss, extremely likely to cause account blowup
  • No free margin check before placing orders with multiplied lot sizes
  • SignalOpenSell function has a dead code bug with unreachable return(false) on line 190

Evaluation scores

Code quality1.0
Strategy logic2.0
Risk management2.0
Robustness2.0
Innovation1.0
Documentation2.0
Overall1.7

Parameters

ParameterDefaultDescription
t16Offset of the first bar
t22Offset of the second bar
Delta_L6Min open price difference between two bars for longs (points)
Delta_S21Min open price difference between two bars for shorts (points)
TakeProfit_L390Long take profit (points)
StopLoss_L1470Long stop loss (points)
TakeProfit_S320Short take profit (points)
StopLoss_S2670Short stop loss (points)
Lots0.1Fixed lot size; 0 uses dynamic risk calculation
AutoLottrueEnable balance-based automatic lot sizing
BigLotSize6Lot multiplier coefficient after a loss
OneMulttrueSingle Martingale multiplier only (otherwise each new position multiplies)
TradeTime14Allowed opening hour (server time)
MaxOpenTime504Maximum position holding time (hours)

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.