DualTrap Breakout
- Experts
- 버전: 1.4
- 활성화: 20
combines a bidirectional breakout straddle strategy with a pending-order-based trailing stop system that simultaneously acts as an automatic stop-and-reverse trigger.
Trading Execution Cycle (4 Main Stages)
-
Bidirectional Trap Placement (Initial Straddle) When there are no active positions or pending orders on the chart, the EA simultaneously places two breakout orders: a Buy Stop above the Ask price and a Sell Stop below the Bid price at a distance of InpPendingDistance . Both orders are immediately equipped with a Stop Loss (InpStopLoss ) to define initial risk in case of a false breakout.
-
Breakout Activation & Opposite Order Cancellation Once the price breaks through one of the levels and triggers a pending order (for example, the Buy Stop is filled and becomes an open Buy position), the EA immediately deletes the opposite initial pending order (Sell Stop) to prevent unintended execution later.
-
Trailing via Pending Orders Instead of modifying a standard Stop Loss like conventional EAs, this system waits for the open position to reach a minimum profit threshold of InpTrailStart . Once reached, the EA places an opposite pending order trailing behind the current market price at a distance of InpTrailDistance :
-
If the active position is a Buy, the EA places a Trailing Sell Stop below the Bid price.
-
If the active position is a Sell, the EA places a Trailing Buy Stop above the Ask price.
-
As long as the price continues moving in the direction of the trend, this trailing pending order advances along with the price (updating whenever price moves more than 10 points in favor) to lock in accumulated gains.
-
-
Profit Locking & Automatic Stop-and-Reverse When the trend reverses and the price triggers the trailing pending order, two actions occur seamlessly:
-
On Hedging Accounts: The trailing order opens as a new position in the opposite direction, and the EA immediately closes the older profitable position—securing the realized gain while letting the new position run with the emerging trend.
-
On Netting Accounts: The trailing pending order volume is automatically calculated as (Current Position Volume + New Lot Size ), closing the existing position and reversing direction in a single atomic execution when triggered.
-
The newly active position will then repeat Stage 3 once it reaches InpTrailStart .
-
Protection & Execution Management Features
-
Orphan Order Cleanup: If a single pending order is left stranded without any open positions (for example, after a manual close or Stop Loss hit), the EA automatically deletes the remaining order so a fresh straddle cycle can begin.
-
Stop Level & Freeze Level Compliance: Order placement distances, Stop Loss levels, and trailing modifications automatically adapt to the broker server's minimum distance requirements (SYMBOL_TRADE_STOPS_LEVEL and SYMBOL_TRADE_FREEZE_LEVEL ) to prevent order rejections.
-
Automatic Lot & Margin Adjustment: Trade volume is normalized to match broker specifications and verified against available Free Margin prior to order submission to prevent insufficient margin errors.
-
Anti-Spam Protection: The EA enforces an execution throttle if a server request fails, preventing repeated order attempts within the same second from flooding the terminal journal.
