SampleCheckPendingOrder
This EA places BuyStop and SellStop pending orders on every tick if no existing pending order of the same type is found. It uses a breakout-style entry where buy stops are placed above the current ask and sell stops below the current bid, both with fixed SL/TP values and daily expiration.
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
This EA employs a breakout pending order strategy, placing BuyStop and SellStop orders simultaneously above and below the current price to catch directional breakouts. Entry conditions: when no existing pending order of the same type and symbol is detected, a BuyStop is placed at the current Ask price and a SellStop at the current Bid price. Exit conditions use fixed pip-based stop loss (300 points) and take profit (900 points), yielding a 1:3 risk-reward ratio. Position sizing relies on a fixed lot size input (0.01), validated by CheckVolumeValue which verifies the lot conforms to the symbol's minimum/maximum volume and volume step requirements. Money management is handled by CheckMoneyForTrade, which calculates required margin and compares it against free margin, skipping the tick if insufficient funds are available. Orders carry a daily expiration (PERIOD_D1), automatically canceling unfilled orders after one day. However, the strategy completely lacks market direction analysis, volatility assessment, or any technical indicator, making it a purely mechanical bidirectional pending order system.
Strengths
- The 1:3 risk-reward ratio is well-designed and aligns with common breakout strategy practices
- Comprehensive money checking including margin sufficiency validation and lot size legality verification
- Pending orders have expiration times, preventing stale orders from tying up margin or triggering at inappropriate times
- Only one pending order per direction is maintained, preventing duplicate orders and uncontrolled position buildup
Weaknesses
- No market direction analysis whatsoever — placing bidirectional orders every tick leads to whipsaw losses in ranging markets
- BuyStop is placed at the current Ask price and SellStop at the current Bid price, meaning orders will be filled almost immediately rather than acting as true breakout orders
- Duplicated money check code in OnTick: IsCheckMoneySell and IsCheckMoneyBuy are each checked twice (lines 59-69)
- OrdersTotal() loop starts at OrdersTotal() instead of OrdersTotal()-1, causing an out-of-bounds access risk on the first iteration
- No new bar check mechanism — every tick triggers order placement attempts, increasing server load and risk of broker restrictions
Possible improvements
- Place BuyStop above Ask and SellStop below Bid by a meaningful distance (e.g., ATR multiple) to create genuine breakout orders rather than near-instant fills
- Add new bar detection to avoid redundant logic execution on every tick, reducing unnecessary resource consumption
- Incorporate trend filtering indicators (e.g., MA direction or ADX) to avoid placing bidirectional orders in ranging markets where both sides lose
- Fix the OrdersTotal() loop off-by-one bug — iteration should start from OrdersTotal()-1
Risk assessment
Overall risk: Medium
- BuyStop/SellStop prices are essentially at market price, causing near-instant fills rather than true breakout behavior
- No new bar check means high-frequency tick environments trigger repeated order attempts, risking broker restrictions
- OrdersTotal() loop off-by-one error may cause pending order check to miss entries, breaking duplicate order protection
- Simultaneous bidirectional orders in ranging markets can lead to consecutive stop-loss hits on both sides
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
PriceVolume | 0.01 | Lot size per trade |
PriceSL | 300 | Stop loss points (0=disabled) |
PriceTP | 900 | Take profit points (0=disabled) |
Similar Breakout EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.