EA-39638 · Martingale

VIDYA N Bars Borders Martingale

This EA uses the VIDYA (Variable Index Dynamic Average) indicator to identify trend direction and trades based on N-bars border breakouts. It employs a martingale position sizing strategy that increases lot size after losing trades, aiming to recover losses with a single winning trade.

Open the interactive view (equity curve, symbol switch)

Key facts

CategoryMartingale
RiskDangerous
Blow-up riskElevated
Rating★★☆☆☆
TypeTrading EA
TimeframesM15, H1, H4
IndicatorsVIDYA, N Bars High/Low
AuthorCopyright © 2022, Vladimir Karputov

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 core concept uses the VIDYA indicator to determine market trend direction, entering trades when price breaks above or below the high/low borders of the last N bars. A long entry occurs when VIDYA trends upward and price breaks above the N-bar upper border, while a short entry occurs when VIDYA trends downward and price breaks below the N-bar lower border. Exit conditions include reaching take-profit or stop-loss levels. Position sizing follows a martingale strategy, multiplying the lot size by a factor after each losing trade to recover accumulated losses with a single win. Money management includes configurable maximum lot size and maximum martingale levels to limit risk exposure, but the inherent danger of exponentially increasing position sizes after consecutive losses remains. The strategy combines trend-following with martingale recovery, which can lead to severe drawdowns and account depletion during prolonged ranging or whipsaw markets.

Strengths

  • VIDYA indicator adapts to market volatility better than simple moving averages due to its variable index mechanism
  • N-bars border breakout logic provides clear and objective entry signals
  • Maximum martingale level and lot size caps provide some protection against unlimited position escalation
  • Combining trend filter with breakout entry performs well in trending markets
  • Highly configurable parameters allow traders to adapt the strategy to different instruments and timeframes

Weaknesses

  • Martingale strategy is inherently high-risk; consecutive losses cause exponential lot size growth that can wipe out the account
  • No spread or slippage filter is applied, which can significantly increase real trading costs during volatile periods
  • Frequent false breakouts in ranging markets trigger consecutive losses and activate the martingale sequence
  • Lacks an overall money management module that dynamically adjusts risk exposure based on account equity
  • Exit mechanism is simplistic with fixed TP/SL only, without trailing stop or trend-reversal exit logic

Possible improvements

  • Add an account equity percentage-based money management module that dynamically adjusts initial lot size
  • Implement trailing stop and trend-reversal exit conditions to protect accumulated profits
  • Add spread and volatility filters to avoid trading during high-cost or low-liquidity periods
  • Consider replacing pure martingale with partial martingale or anti-martingale to reduce consecutive loss risk

Risk assessment

Overall risk: Dangerous

  • Martingale lot escalation after consecutive losses can lead to account blow-up
  • No spread filter or slippage protection means actual execution costs may severely deviate from expectations
  • Lacks holistic money management with no dynamic position sizing based on account equity
  • Fixed TP/SL ignores market volatility changes and may be triggered at inappropriate levels

Evaluation scores

Code quality3.0
Strategy logic2.0
Risk management1.0
Robustness2.0
Innovation2.0
Documentation1.0
Overall1.8

Parameters

ParameterDefaultDescription
VIDYA_Period9VIDYA indicator calculation period
N_Bars20Number of bars for price boundary calculation
Multiplier2.0Martingale multiplier factor applied after loss
MaxLot10.0Maximum allowedtradinglot size
MaxMartingaleLevel5Maximum martingale level limit
StopLoss500Stop loss in points
TakeProfit500Take profit in points
LotSize0.01Lot size per order

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.