SampleDetectEconomicCalendar
This EA detects high-impact economic calendar events for USD-based currency pairs and places BuyStop/SellStop pending orders shortly before the news release time. It uses the MQL5 Calendar API to filter high-importance events and sets straddle orders with configurable distances, stop loss, take profit, and trailing stop. Trading is only triggered during a narrow window before news releases.
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
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 concept is a news straddle approach, placing both BuyStop and SellStop pending orders shortly before high-impact economic releases to capture sharp volatility spikes. Entry conditions require: the symbol's base currency is USD, high-importance calendar events exist within a 4-hour lookback to 1-day forward window, and the server time is within 5 minutes before the news release. Exit conditions include fixed stop loss, take profit, order expiration time, and a fixed-pip trailing stop. Position sizing supports both fixed lot and risk-based modes, where the risk mode calculates lot size as 3% of account balance divided by the stop loss distance. Money management includes validation against minimum/maximum volume, volume step compliance, and margin sufficiency checks before placing orders. The strategy is semi-automated as it only trades USD-base pairs and skips all others entirely.
Strengths
- Uses MQL5 native Calendar API for reliable and real-time economic event data
- Straddle pending order approach captures volatility in either direction after news releases
- Comprehensive money management checks: volume range validation, step validation, and margin sufficiency
- Prevents duplicate orders by checking order comments as unique identifiers
- Supports trailing stop to lock in profits after favorable moves
Weaknesses
- Only trades USD-base currency pairs, ignoring quote-currency-USD pairs, severely limiting scope
- OnTick is empty and FuncTradeNews is never called, so the EA will not actually execute any trading logic
- News array is fixed at 1000 with no bounds checking, and loops use ArraySize instead of actual count k
- Pending order distances don't account for SYMBOL_TRADE_STOPS_LEVEL, risking order rejection by broker
- Lacks post-news order management, such as cleanup of untriggered straddle orders after the event passes
Possible improvements
- Call FuncTradeNews from OnTick or OnTimer so the EA actually executes its trading logic
- Extend currency filtering to support quote-currency-USD pairs like EURUSD and GBPUSD
- Add post-news cleanup logic for untriggered pending orders to prevent order accumulation
- Use actual count k instead of ArraySize for news data iteration to avoid looping over empty slots
Risk assessment
Overall risk: Medium
- Core trading function is never called, leaving the EA effectively inert and potentially creating a false sense of security
- News trading carries high slippage risk; pending order prices may experience significant deviation during volatility spikes
- Both straddle orders could be triggered during extreme volatility, resulting in double loss exposure
- No spread filter; widening spreads around news events can cause abnormal order fills
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
Tradenews | false | Enable news trading feature |
PriceVolume | 0.01 | Fixed trading lot size |
PriceSL | 300 | Stop loss in points (0=disabled) |
PriceTP | 900 | Take profit in points (0=disabled) |
trailingstoppoint | 200 | Trailing stop in points |
Expirydate | PERIOD_D1 | Pending order expiration period |
UseMoneyManagement | false | Enable auto lot calculation via money management |
Buydistance | 400 | Buy pending order distance from current price in points |
Selldistance | 400 | Sell pending order distance from current price in points |
Similar News Trading EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.