Exp_EMA-Crossover_Signal
This EA trades based on the EMA-Crossover_Signal custom indicator, opening buy positions on upward crossover signals and sell positions on downward crossover signals. It supports configurable money management modes, stop loss/take profit, and separate toggle controls for opening and closing positions on both sides. The strategy operates on new bar events with a historical bar lookup to determine if opposing positions should be closed.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
Not backtested yet — this EA could not be converted automatically.
Strategy analysis
The strategy concept is based on a crossover of two moving averages with different periods, where the faster MA crossing above the slower MA generates a buy signal and vice versa for sell signals. Entry conditions require the EMA-Crossover_Signal indicator to output a non-zero and non-EMPTY_VALUE signal at the specified SignalBar position, with UpValue triggering long entries and DnValue triggering short entries. Exit conditions include configurable stop loss and take profit in points, and when reverse-close toggles are enabled, the EA scans historical bars to find earlier opposing signals to determine whether to close existing positions. Position sizing is controlled by the MM parameter which sets the lot ratio, supporting five money management modes: free margin-based, balance-based, loss-adjusted free margin, loss-adjusted balance, and fixed lot size. The money management leverages the standardized TradeAlgorithms.mqh library module, providing dynamic position sizing ranging from fixed lots to margin-calculated approaches based on different equity metrics.
Strengths
- Provides independent toggle switches for opening and closing positions on both sides, offering high flexibility for unidirectional or close-only trading configurations
- Supports five money management modes from fixed lots to dynamic margin-based sizing, accommodating various risk appetites
- Uses IsNewBar mechanism to control signal calculation frequency, preventing duplicate trade triggers within the same bar
- Complete stop loss and take profit parameters with a default 2:1 reward-to-risk ratio (1000 SL vs 2000 TP)
- Clean code structure leveraging the TradeAlgorithms.mqh library for trade logic encapsulation, reducing code duplication
Weaknesses
- The FastMA period of 5 and SlowMA period of 6 are too close, which can generate frequent false crossover signals leading to overtrading
- The reverse-close logic iterates through all historical bars without an upper bound optimization, potentially causing performance issues on long chart histories
- No spread filter mechanism exists, so signals may be overwhelmed by noise in high-spread environments leading to unfavorable entries
- Depends on iCustom calling the external EMA-Crossover_Signal indicator, adding deployment complexity and dependency risk
- The Recount flag is set to true on CopyBuffer failure but only recalculates on the next tick, potentially delaying signals during fast market moves
Possible improvements
- Increase the gap between FasterMA and SlowerMA periods (e.g., 5 and 20), or add signal confirmation requiring the signal to persist for 2-3 bars to reduce false signals
- Add a maximum search range limit to the historical bar iteration for reverse-close logic to avoid unnecessary performance overhead on very long chart histories
- Add spread filter and volatility filter to suppress trading signals in high-spread or low-volatility environments
Risk assessment
Overall risk: Medium
- The minimal 1-period gap between Fast and Slow MA generates frequent false signals that can lead to consecutive losses
- The reverse-close logic iterates through all historical bars without an upper bound, posing performance and logic risks
- Lack of spread filter and maximum position check may cause frequent entries under unfavorable conditions
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
MM | 0.1 | Money management ratio or lot size |
MMMode | LOT | Money management mode (free margin/balance/post-loss margin/post-loss balance/fixed lot) |
StopLoss_ | 1000 | Stop loss in points |
TakeProfit_ | 2000 | Take profit in points |
Deviation_ | 10 | Maximum allowed slippage |
BuyPosOpen | true | Allow opening long positions |
SellPosOpen | true | Allow opening short positions |
BuyPosClose | true | Allow closing long positions |
SellPosClose | true | Allow closing short positions |
InpInd_Timeframe | PERIOD_H4 | EMA Prediction indicator timeframe |
FasterMA | 5 | Fast moving average period |
SlowerMA | 6 | Slow moving average period |
MAType | MODE_LWMA | Moving average calculation method |
MAPrice | PRICE_CLOSE | Moving average applied price |
SignalBar | 1 | Bar index for signal calculation |
Similar Trend Following EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.