EA-36713 · Momentum

OpenPendingorderAfterPositionGetStopLoss

This EA uses the Stochastic oscillator to generate momentum-based entry signals, placing Buy Stop or Sell Stop pending orders when the main line crosses above or below its lagged value. When a position is closed by stop loss, it automatically opens a reversal pending order in the opposite direction, creating a continuous trading cycle that re-enters after every SL hit.

Open the interactive view (equity curve, symbol switch)

Key facts

CategoryMomentum
RiskCaution
Blow-up riskLow
Rating★★☆☆☆
TypeTrading EA
TimeframesM15, H1, H4
IndicatorsStochastic
AuthorTungman

Backtest results (H1, about 1 year)

SymbolP&LAnnualMax DDTradesWin rateSharpeRecoveryLosing streakPer tradeStatus
EURUSD-0.64%-0.56%0.80%14446.20%-1.29-0.807−$0.47Reliable
GBPUSD-1.08%-0.94%1.32%14339.90%-1.77-0.8210−$0.76Reliable
USDJPY-0.13%-0.12%0.47%23450.20%-0.25-0.287−$0.05Reliable
XAUUSD-1.71%-1.41%13.66%15153.00%-0.15-0.129−$1.13Reliable

Profitable on 0 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 Momentum EAs with a reliable result on the same market: EURUSD: better than 46% of 68 · GBPUSD: better than 55% of 66 · USDJPY: better than 57% of 68 · XAUUSD: better than 56% of 75

Month by month

MarketMonths with a gainBest monthWorst month
EURUSD46%+0.08% 2026-09-0.29% 2026-02
GBPUSD23%+0.27% 2026-07-0.33% 2026-05
USDJPY54%+0.19% 2026-08-0.19% 2026-01
XAUUSD46%+4.52% 2026-01-4.51% 2026-07

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 EA's strategy concept is based on the Stochastic momentum indicator to determine trend direction: when the main line value is below its value 2 bars ago, it identifies bearish momentum and places a Sell Stop pending order; when above, it identifies bullish momentum and places a Buy Stop pending order. Entry conditions rely on Stochastic main line momentum shifts, with pending order prices set beyond the current price plus the stop level distance, ensuring entry after a breakout. Exit conditions are stop loss and take profit, with a fixed-pip trailing stop also supported via CTrailingFixedPips. Position sizing uses a fixed lot size (PriceVolume) with a maximum position count controlled by the Maxposition parameter. Money management includes the CheckMoneyForTrade function to verify available margin and CheckVolumeValue to validate lot size compliance with broker requirements. The distinctive feature is in OnTradeTransaction where it detects stop loss deal events (DEAL_REASON_SL): when a position is closed by stop loss, it immediately places a new pending order in the opposite direction, creating a stop-loss-then-reverse cycle. Pending orders have expiration times, with the OnTick orders using H4 expiration and the reversal orders using the user-configured Expirydate parameter.

Strengths

  • Automatic reversal pending order after stop loss hit, capturing oscillating market moves
  • Complete margin check and volume validation to prevent non-compliant orders
  • Uses pending orders instead of market orders for entry, reducing false breakout risk
  • Limits maximum position count (Maxposition) to control risk exposure
  • Pending order expiration mechanism prevents stale order accumulation

Weaknesses

  • Unlimited reversal pending orders after stop loss can cause consecutive losses in trending markets
  • Step and TargetProfit parameters are declared but unused in core logic, creating dead parameters
  • Inconsistent pending order expiration between OnTick (H4) and OnTradeTransaction (Expirydate), causing logical inconsistency
  • The reversal condition (trans.price > trans.price_sl) is questionable; the relationship between deal price and SL price may be incorrectly evaluated
  • No new bar detection means the EA checks indicators and potentially places orders on every tick, risking frequent repeated orders
  • SumPosition iterates from PositionsTotal() but max index should be PositionsTotal()-1, causing an out-of-bounds access risk

Possible improvements

  • Add a maximum consecutive stop loss count limit to prevent unlimited reversal losses in strong trends
  • Add new bar detection logic to avoid recalculating indicators and placing orders on every tick
  • Unify pending order expiration logic between OnTick and OnTradeTransaction to eliminate inconsistency
  • Fix index out-of-bounds issue in SumPosition and CheckPendingOrder (should start from Total-1)
  • Implement the Step parameter in actual logic to control distance between positions

Risk assessment

Overall risk: Caution

  • Unlimited reversal pending order mechanism after stop loss can cause consecutive losses in trending markets
  • No new bar detection means order attempts on every tick, increasing overtrading risk
  • Array index out-of-bounds bug in PositionsTotal()/OrdersTotal() iteration may cause runtime errors
  • Price comparison logic in stop loss reversal condition may be incorrect, causing unwanted reversals

Evaluation scores

Code quality2.0
Strategy logic2.0
Risk management3.0
Robustness2.0
Innovation3.0
Documentation1.0
Overall2.2

Parameters

ParameterDefaultDescription
PriceVolume0.01Trading lot size
PriceSL1000Stop loss points (0=disabled)
PriceTP900Take profit points (0=disabled)
trailingstoppoint200Trailing stop trigger points
ExpirydatePERIOD_D1pending orderexpirationtime period
Step500Position spacing distance
TargetProfit6Target profit
RefreshTime60Refresh interval (seconds)
HistorySL7Historical stop loss lookup days
Slippate10Slippage tolerance in points
KPeriod22Stochastic %K period
DPeriod7Stochastic %D period
STOPricemethodSTO_CLOSECLOSEStochasticpricecalculation method
Slowing2Stochastic slowing period
Maxposition1Maximum positions

Similar Momentum 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.