EA-275 · Trend Following

bobnaley

This EA opens long positions when the Moving Average is rising, price is above MA, and Stochastic is rising from below the oversold level. It opens short positions when the MA is falling, price is below MA, and Stochastic is declining from above the overbought level. Position sizing is dynamically calculated based on free margin with a maximum lot cap of 15.

Open the interactive view (equity curve, symbol switch)

Key facts

RiskHigh risk
Blow-up riskLow
Rating★☆☆☆☆
TypeTrading EA
TimeframesM15, H1, H4
IndicatorsSMA, Stochastic
AuthorAM2.

Backtest results (H1, about 1 year)

SymbolP&LAnnualMax DDTradesWin rateSharpeRecoveryLosing streakPer tradeStatus
EURUSD+7.01%+6.07%2.61%14356.30%1.582.698+$4.70Reliable
GBPUSD+2.67%+2.31%4.98%14349.30%0.470.546+$1.71Reliable
USDJPY-1.92%-1.67%4.90%14347.90%-0.38-0.395−$1.46Reliable
XAUUSD+58.82%+46.55%44.92%15151.30%1.351.316+$40.86Reliable

Profitable on 3 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 93% of 95 · GBPUSD: better than 68% of 95 · USDJPY: better than 33% of 95 · XAUUSD: better than 80% of 96

Month by month

MarketMonths with a gainBest monthWorst month
EURUSD77%+3.26% 2026-02-0.82% 2026-10
GBPUSD54%+3.74% 2026-02-1.89% 2026-03
USDJPY46%+1.62% 2026-09-1.65% 2026-08
XAUUSD54%+62.96% 2026-01-21.74% 2026-09

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

This EA employs a combined Moving Average and Stochastic oscillator trend-following strategy. Entry conditions for longs require the MA to be consecutively rising over 3 bars, the Ask price above the current MA value, Stochastic rising and below the oversold level of 30. Entry for shorts requires MA consecutively declining, Bid below MA, and Stochastic declining above the overbought level of 70. However, there is a critical logic bug: the buy condition uses maVal[0]<maVal[1]<maVal[2], which actually checks for MA decreasing (since index 0 is the most recent value from CopyBuffer), contradicting the comment that says 'MA increases'. Exit relies entirely on fixed take-profit and stop-loss levels with no trailing stop or dynamic exit. Position sizing is calculated via Money_M() using free margin divided by 100000 multiplied by 50, clamped between 0.1 and 15 lots with variable decimal normalization. Money management requires at least 5000 in free margin and restricts to one position per symbol at a time. The StopLoss and TakeProfit input values appear to be in price units (0.0035 and 0.007) rather than points, which may cause issues depending on the symbol's price scale.

Strengths

  • Dual indicator filter (MA + Stochastic) reduces false breakout signals
  • Dynamic position sizing adapts lot size to account equity for some self-adaptation
  • Maximum lot cap (15) and minimum free margin requirement (5000) prevent excessive leverage
  • Single position per symbol restriction avoids pyramiding risk on the same direction

Weaknesses

  • Critical logic bug in MA direction check: maVal[0]<maVal[1] actually means MA is declining not rising, completely reversing the intended strategy logic
  • StopLoss and TakeProfit use price units instead of points, which may fail on symbols with different quote precision
  • The Lot input parameter (5) is completely unused as Money_M() overrides it, misleading the user
  • No new bar detection means signal logic runs every tick, risking redundant trade attempts
  • Trade execution result from PositionOpen is not checked, so failed orders go unnoticed
  • Fixed SL/TP values without ATR or volatility-based dynamic adjustment limit adaptability across instruments

Possible improvements

  • Fix the MA direction logic bug: buy condition should use maVal[0]>maVal[1]&&maVal[1]>maVal[2], sell condition should use maVal[0]<maVal[1]&&maVal[1]<maVal[2]
  • Convert SL/TP to point-based units with symbol tick size normalization, or use ATR-based dynamic calculation
  • Add new bar detection (e.g. compare current vs previous bar time) to avoid redundant per-tick signal evaluation and trade attempts
  • Check PositionOpen return value and handle trade failures, remove the unused Lot input parameter or integrate it into money management logic

Risk assessment

Overall risk: High risk

  • MA direction logic is reversed from strategy intent, potentially causing counter-trend entries: shorting in uptrends and buying in downtrends
  • SL/TP using absolute price values instead of points may produce extremely small or large stop ranges on 5-digit quotes or different instruments
  • Per-tick signal evaluation without new bar filtering could lead to duplicate position attempts during fast market moves due to PositionSelect latency
  • Unchecked trade execution results mean SL/TP levels rejected by the server would silently fail, leaving positions unprotected

Evaluation scores

Code quality2.0
Strategy logic1.0
Risk management2.0
Robustness1.0
Innovation1.0
Documentation2.0
Overall1.5

Parameters

ParameterDefaultDescription
TakeProfit0.007Take profit distance (price units)
StopLoss0.0035Stop loss distance (price units)
MA_Period76Moving average period
Stoch_OverSold30stochasticindicatoroversold level
Stoch_OverBought70stochasticindicatoroverbought level
Lot5Lot size (unused; actual size computed by Money_M())

Similar Trend Following 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.