Astra Breakout EA
- Эксперты
- Версия: 1.32
- Активации: 20
This EA utilizes a Two-Way Pending Order Breakout Strategy (placing both Buy Stop and Sell Stop simultaneously) executed whenever a new bar/candle forms.
-
Order Placement:
-
When a new bar appears ( IsNewBar()), the EA measures a distance set by InpDistancePointsabove the current Ask price to place a Buy Stop.
-
Simultaneously, the EA places a Sell Stop at InpDistancePointsbelow the current Bid price.
-
-
Single Trade Management ( InpOneTradeOnly = true):
-
If one of the pending orders is triggered and turns into an active position (e.g., Buy is executed), the EA detects the position via the CountPositions()function.
-
It then automatically deletes the remaining pending order (Sell Stop) to prevent hedging or dual opposite positions.
-
EA v1.32 comes with several internal validation checks before sending orders to the broker server:
-
Daily Rollover / Market Close Filter ( IsTradeAllowed):
-
Prevents [Market closed]issues that frequently occur during daily rollover hours (23:00–00:05).
-
Checks the instrument status via SYMBOL_TRADE_MODE_FULL. If the market is disabled or in a rollover window, the EA pauses execution until the market reopens.
-
-
Automatic Filling Mode Detection ( SetTradingFillingMode):
-
Dynamically adapts the order execution filling type ( ORDER_FILLING_FOK, ORDER_FILLING_IOC, or ORDER_FILLING_RETURN) based on the broker's specific requirements to avoid execution failures (invalid filling type).
-
-
Broker Stop Level Validation:
-
Ensures that the distances for buy_priceand sell_pricesatisfy the broker's minimum required distance (Stops Level).
-
-
Pending Expiration Limitation:
-
Pending orders have a designated validity period defined by InpPendingExpireMin(in minutes). If the price does not reach the pending orders within this period, the broker cancels them automatically.
-
The ApplyTrailingStop()function runs continuously on every price movement (tick):
-
Trailing Start Activation ( InpTrailStart):
-
The EA monitors active trades. Once a trade moves in a profitable direction past InpTrailStartpoints from the open price, the Trailing Stop is activated.
-
-
Profit Locking with Step ( InpTrailStep):
-
The Stop Loss (SL) is adjusted to Current Price - InpTrailStep.
-
The SL modification only occurs if the new SL value is higher than the previous SL (for Buy positions) or lower than the previous SL (for Sell positions).
-
On every incoming price tick, the EA performs the following steps:
-
Update Trailing Stop: Checks and adjusts the Stop Loss of active positions if the Trail Start conditions are met.
-
Check Active Positions: If InpOneTradeOnlyis set to trueand an active position already exists, it deletes all remaining pending orders and halts further processing in OnTick().
-
Detect New Bar: If a new bar has not formed yet, the EA skips creating new orders.
-
Execute New Orders:
-
Validates market status via IsTradeAllowed().
-
Clears old pending orders from the previous bar using DeletePendings().
-
Calculates lot size ( NormalizeLot), SL/TP levels, and places new Buy Stop and Sell Stop pending orders via PlaceOrders().
-
