Strategy & Execution Architecture
AIMS LOBOT EA combines mechanical price action filters with systematic capital preservation algorithms. It is designed to capture directional momentum expansions following market compression at the London session open.
1. Structural Signal Detection & Inside Bar Compression
The algorithm executes according to clear price-action rules:
The Inside Bar Filter
- Definition: An Inside Bar occurs when the high of the current closed candle (
Bar 1) is lower than the high of the preceding candle (Bar 2), and its low is higher than the low of the preceding candle. - Significance: Represents volatility compression and order accumulation before directional expansion.
Session Benchmark Alignment
- Daily Session Line (
InpOpenHour:InpOpenMinute): The EA calculates the open price of the designated session hour (typically 09:00 broker time for London open). - Directional Constraint:
- If the Inside Bar is situated above the Session Open price, only bullish Buy Stop orders are queued.
- If situated below, only bearish Sell Stop orders are queued.
- Order Placement: Pending Stop orders are positioned at
High[1] + InpBufferPips(for Buys) andLow[1] - InpBufferPips(for Sells). Initial Stop Loss is placed on the opposite boundary of the Inside Bar.
2. Risk-Neutral Capital Preservation Model
Standard breakout systems frequently encounter whipsaws when trailing stops are moved prematurely to the entry price (+0.0), terminating positions during routine intraday pullbacks.
AIMS LOBOT EA employs a mathematical partial liquidation model to establish a net-neutral risk structure while allowing the position sufficient room to develop:
Mathematical Framework
- At Order Entry: Total risk is sized to the initial distance between entry and Stop Loss (
1.0R, calibrated to 1% of account equity). - At +1.0R Milestone: The engine automatically closes 50% of trade volume:
Realized Return = +0.5R
- Runner Position Mechanics: The remaining 50% volume maintains its original structural Stop Loss level.
- Adverse Retest Scenario: Should market price retrace completely and strike the original Stop Loss:
Runner Result = -0.5RNet Trade Outcome = (+0.5R) + (-0.5R) = 0.0R
- Structural Integrity: Because the Stop Loss is not compressed directly to the entry price, the runner survives normal market retracements and remains positioned for multi-hour trend continuation.
3. Dynamic ATR Trailing Stop Ratchet
Following execution of the partial liquidation at +1.0R, the dynamic Average True Range (ATR) trailing algorithm becomes active:
- Calculation: Trails behind price action by
ATR(14) * InpATRMultiplier. - Directional Lock: The Stop Loss ratchets strictly in the direction of the trade and never widens.
- Execution Safeguards: Incorporates broker
MODE_FREEZELEVELandMODE_STOPLEVELvalidation checks to prevent order modification rejections from broker trade servers during fast market conditions.
4. Pyramiding Architecture
When InpMaxOpenTrades > 1:
- The EA allows subsequent Inside Bar breakout setups in the same direction only after all existing active positions have achieved partial liquidation at +1.0R.
- This structural gate ensures that total open account risk does not compound beyond the baseline risk threshold while scaling into sustained trends.
5. R-Multiple Telemetry & CSV Logging
To support empirical analysis, the EA logs trade metrics directly to the MetaTrader 4 data directory:
MQL4/Files/AIMSLOBOT_R_Analytics.csv
Ticket,Symbol,Direction,OpenTime,CloseTime,EntryPrice,InitialSL,RiskPips,Hit1R,MaxMFE_R,RealizedR,NetProfit,ExitReason
Hit1R: Flag indicating whether the position reached the+1.0Rcapital preservation milestone (1) or stopped out prior (0).MaxMFE_R: Maximum Favorable Excursion achieved during the lifecycle of the position, measured in R-multiples.RealizedR: Total net realized R-multiple upon final position closure.