EA Framework Layout (500.mq5)
This EA is a trend-following framework built on top of a base class (EABaseFrame), using multiple moving average arrays to determine trade direction. Entry signals rely on MA direction checks and session time filters for US and non-US currency pairs. Exit conditions use MA direction reversal combined with a bar-based holding duration threshold, while add-position logic triggers when floating profit exceeds a multiple of current lot size.
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.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| GBPUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| USDJPY | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| XAUUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
Why this EA never traded: no entry rule survived the conversion.
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.
Blow-up risk: No blow-up pattern found
- Has no stop loss or trailing stop
On its own this is not a typical blow-up pattern, 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's core concept is trend detection using multiple moving average arrays, where MA_Direction evaluates MA alignment to determine bullish or bearish bias. Entry conditions in LongOpen and ShortOpen rely on IsMAEverFit() which checks MA fitting across shifted arrays, but the critical calls are currently commented out, rendering the EA unable to generate actual entry signals. Exit conditions trigger when the MA direction (computed with period 2 and shift 1) diverges from the position's direction, provided the holding duration in H1 bars exceeds will_close_bars. Add-position logic activates when floating profit exceeds 500 times the current lots, adding the initial lot size without a specific price target. Position sizing uses a lot_amplifier multiplier calibrated against a 10% drawdown on $2000 capital. Session filtering supports separate US and non-US trading windows with fractional hour precision for minute-level boundaries. Overall, the framework is structurally complete but the core entry logic remains unimplemented, making it non-functional in its current state.
Strengths
- Well-structured OOP design inheriting from EABaseFrame base class, clean architecture easy to extend and maintain
- Separate US and non-US session time filters with minute-level precision offer good flexibility for different currency pairs
- Add-position logic is profit-triggered rather than loss-based, avoiding martingale-style risk accumulation
- Multiple MA arrays with sliding window validation reduce false trend signals
Weaknesses
- Core entry logic (IsMAEverFit calls in LongOpen/ShortOpen) is commented out, the EA cannot actually open trades in its current state
- CheckReverse and CheckModify are empty stubs, reverse and SL/TP modification features are missing
- IsInDealTime has a logic bug: lines 145 and 151 compare hour values with minute values, making boundary conditions incorrect
- No explicit stop-loss or take-profit settings, relying solely on direction reversal for exit creates unbounded risk in extreme markets
- Hardcoded symbol EURUSD with no multi-instrument adaptation capability
Possible improvements
- Fix the boundary condition bug in IsInDealTime where hour values are incorrectly compared with minute values on lines 145 and 151
- Implement the commented-out entry logic in LongOpen/ShortOpen and add explicit stop-loss/take-profit to control per-trade risk
- Remove hardcoded EURUSD symbol and use the chart symbol automatically for multi-instrument support
Risk assessment
Overall risk: Medium
- Entry logic is commented out making it non-trading, but if uncommented, lack of stop-loss could cause large losses in extreme moves
- Add-position based solely on floating profit with no count limit can amplify losses on trend reversal
- IsInDealTime logic bug may cause trades at unintended hours or missed trading windows
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
lot_amplifier | 1 | Lot size multiplier, based on 10% drawdown on $2000 |
Trade_Init_Lots | 0.01 | Initial order lot size |
Auto_Close_After_X_H1 | 4 | Auto close position after X hours |
Is_Reverse | false | Reverse trade direction |
Deal_Direction_Allow | BOTH | Allowed direction: long/short/both |
USTime_LeftBound | 2 | US session active start hour |
USTime_RightBound | 23 | US session active end hour |
NUSTime_LeftBound | 0 | Non-US session active start hour |
NUSTime_RightBound | 0 | Non-US session active end hour |
Similar Trend Following EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.