iMA iStochastic Custom
This EA combines a Moving Average (iMA) trend filter with a Stochastic Oscillator (iStochastic) to generate trade signals. It enters long positions when the price is above the MA and the Stochastic exits oversold territory, and enters shorts when the price is below the MA and the Stochastic exits overbought territory. The strategy aims to capture trend-following entries on momentum reversals within the prevailing trend 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 | +0.96% | +0.83% | 4.82% | 121 | 50.00% | 0.24 | 0.20 | 7 | +$1.08 | Reliable |
| GBPUSD | +1.83% | +1.59% | 4.12% | 124 | 48.00% | 0.35 | 0.44 | 7 | +$1.68 | Reliable |
| USDJPY | +5.65% | +4.90% | 3.92% | 120 | 55.50% | 1.15 | 1.44 | 3 | +$4.88 | Reliable |
| XAUUSD | +77.50% | +60.66% | 30.20% | 118 | 53.00% | 1.10 | 2.57 | 5 | +$68.36 | Reliable |
Profitable on 4 of 4 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 Trend Following EAs with a reliable result on the same market: EURUSD: better than 67% of 95 · GBPUSD: better than 61% of 95 · USDJPY: better than 97% of 95 · XAUUSD: better than 84% of 96
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 46% | +2.61% 2026-04 | -1.27% 2026-03 |
| GBPUSD | 54% | +3.20% 2026-04 | -2.99% 2026-03 |
| USDJPY | 54% | +2.86% 2026-07 | -0.83% 2026-08 |
| XAUUSD | 62% | +70.48% 2026-02 | -13.23% 2026-08 |
From the backtest equity curve, sampled about every two days; only reliable results.
Blow-up risk: No blow-up pattern found
None of the usual blow-up patterns were found in the code, and the account was not stopped out in our backtests. That is not a guarantee: any EA can lose money.
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 employs a dual-indicator combination approach, using a Moving Average as the trend direction filter and the Stochastic Oscillator as the entry timing trigger. Entry conditions require: long positions when price is above the MA and the Stochastic crosses upward from oversold territory (below the 20 level), and short positions when price is below the MA and the Stochastic crosses downward from overbought territory (above the 80 level). Exit conditions typically rely on Stochastic reverse crossovers or fixed stop-loss and take-profit levels. Position sizing uses a fixed lot approach, lacking dynamic lot calculation based on volatility or account risk percentage. Money management is limited to basic stop-loss settings, missing advanced risk management features such as trailing stops, partial closes, or break-even functionality. The overall strategy logic is simple and intuitive, suitable for trending markets, but prone to frequent false signals and consecutive losses in choppy or ranging market conditions.
Strengths
- Dual-indicator combination effectively filters false signals in ranging markets, improving entry quality
- Clear and understandable strategy logic, suitable for beginners to comprehend and optimize parameters
- Trend-following concept is sound, performing well in clearly trending market conditions
Weaknesses
- Fixed lot sizing lacks dynamic position management, unable to adapt risk exposure based on market volatility
- Missing trailing stop mechanism, profitable positions may give back significant gains during retracements
- Generates frequent false breakout signals in choppy consolidation markets leading to consecutive losses
- No new bar check mechanism, potentially opening duplicate positions on the same candle
Possible improvements
- Add ATR-based dynamic stop-loss, take-profit, and trailing stop mechanisms to enhance risk management
- Implement new bar check and position check logic to prevent duplicate entries and overexposure
- Introduce multi-timeframe confirmation, e.g., confirming trend on H4 before seeking entries on H1
Risk assessment
Overall risk: Medium
- Fixed lot size does not adjust for account balance and volatility, potentially creating excessive risk exposure during large moves
- Missing new bar check mechanism creates risk of duplicate position opening on the same candle
- Stop-loss and take-profit may default to zero, creating potential for unlimited losses without protection
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
MAPeriod | 14 | Moving average period |
MA_Method | MODE_SMA | Moving average calculation method |
MA_Applied_Price | PRICE_CLOSE | Moving average applied price |
Stochastic_KPeriod | 5 | Stochastic K period |
Stochastic_DPeriod | 3 | Stochastic D period |
Stochastic_Slowing | 3 | Stochastic slow smoothing period |
Stochastic_Oversold | 20 | Oversold threshold |
Stochastic_Overbought | 80 | Overbought threshold |
StopLoss | 0 | Stop loss in points |
TakeProfit | 0 | Take profit in points |
LotSize | 0.1 | Fixed trading lot size |
Similar Trend Following EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.