Smart Trend Follower
This EA is a trend-following martingale system that uses either MA crossover or MA+Stochastic confirmation to generate trade signals. On losing positions, it opens additional layers at fixed pip distances with multiplied lot sizes (martingale), then sets a common break-even TP/SL across all positions of the same direction.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
| Symbol | P&L | Annual | Max DD | Trades | Win rate | Sharpe | Recovery | Losing streak | Per trade | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| EURUSD | +2.31% | +2.00% | 4.76% | 13 | 83.30% | 0.44 | 0.48 | 1 | +$42.93 | Reliable |
| GBPUSD | -3.89% | -3.39% | 8.34% | 1 | 0.00% | — | — | — | — | Too few trades |
| USDJPY | +2.69% | +2.33% | 6.71% | 14 | 100.00% | 0.40 | 0.40 | 0 | +$44.83 | Reliable |
| XAUUSD | +93.97% | +72.87% | 45.24% | 55 | 63.00% | 1.09 | 2.08 | 7 | +$243.64 | Reliable |
Profitable on 3 of 3 markets with reliable results.
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.
Against the other Martingale EAs with a reliable result on the same market: EURUSD: better than 94% of 16 · USDJPY: better than 75% of 16 · XAUUSD: better than 69% of 16
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 54% | +3.43% 2026-03 | -1.75% 2026-01 |
| USDJPY | 54% | +1.94% 2025-12 | -2.31% 2026-03 |
| XAUUSD | 62% | +54.18% 2026-02 | -26.98% 2026-06 |
From the backtest equity curve, sampled about every two days; only reliable results.
Blow-up risk: High
- Increases the position size after losses (martingale)
- Has no stop loss or trailing stop
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 trend following with two entry signal modes: one is dual MA crossover (fast MA crossing above slow MA for buy, below for sell), and the other uses MA trend direction confirmation combined with Stochastic oversold/overbought zone filtering and candle direction confirmation. Exit conditions use a weighted average break-even price across all same-direction positions plus a fixed pip take-profit, with optional stop-loss. Position sizing employs a martingale approach where the first position uses the initial lot size, and each subsequent layer multiplies the lot by a configurable multiplier (default 2x), with layers spaced at a fixed 200-pip distance. Money management includes lot normalization, minimum/maximum lot limits, lot step alignment, and margin checking, but lacks overall risk exposure limits. The EA detects signals on each new candle and continuously modifies TP/SL for all positions to maintain a unified exit target.
Strengths
- Provides two entry signal modes (MA crossover and MA+Stochastic trend confirmation), adding strategy flexibility
- Includes thorough margin checking and lot normalization logic to prevent invalid orders
- Unified TP/SL management for same-direction positions based on weighted average break-even price, with clear logic
Weaknesses
- Martingale strategy carries extreme risk; consecutive layering causes exponential lot growth that can rapidly blow the account
- Default stop-loss is 0, meaning martingale positions accumulate without any safety net, making risk uncontrollable
- Bug in getTotalVolume: uses PositionGetDouble instead of OrderGetDouble for pending orders volume
- CopyBuffer return values are not checked, so failed indicator data reads can produce wrong signals
Possible improvements
- Mandate a stop-loss or add a maximum layer count limit to control martingale risk exposure
- Fix the getTotalVolume bug using OrderGetDouble for pending orders instead of PositionGetDouble, and check CopyBuffer return values
- Add maximum drawdown protection that forces position closure when floating loss reaches a configurable percentage of account balance
Risk assessment
Overall risk: Dangerous
- Martingale lot sizing grows exponentially; consecutive layering can rapidly deplete account funds
- Default stop-loss of 0 means multi-layer positions have no protection, and a sustained trend can cause massive losses
- No maximum layer count limit means risk exposure is unbounded in extreme market conditions
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
inMagicNumber | 778899 | Magic number for identifying EA positions |
inLotSize | 0.01 | Initial lot size |
inMultiply | 2.0 | Martingale multiplier, lot scaling factor per layer |
inJarakLayer | 200 | Layer spacing (points), price distance for adding positions |
inJnsSignal | eTypeCrossMA | Signal type: MA crossover or trend following |
inMAPeriodFast | 14 | fastMA period |
inMAPeriodSlow | 28 | slowMA period |
inSTOKPeriod | 10 | Stochastic %K period |
inSTODPeriod | 3 | Stochastic %D period |
inSTOSlowing | 3 | Stochastic smoothing period |
inTakeProfit | 500 | Take profit in points |
inStopLoss | 0 | Stop loss in points (0 = no stop loss) |
Similar Martingale EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.