# HITEntryEA Specification ## 1. Overview `HITEntryEA.mq5` is the entry-only Expert Advisor. It runs the H4/H1 Python signal workflow, applies the M15 confirmation rules, and submits pending orders. It does not manage filled positions. Stop management, trailing, and time-based position exits are delegated to `HITPositionManagerEA.mq5`. The two EAs coordinate through matching `_Symbol` and `input_entry_magic_number` / `input_managed_magic_number`. The operating assumption is a retail hedging account. ## 2. Indicators - No standard or custom indicators are used. - Confirmed H4/H1 OHLC data is exported to Python. The EA reads `trend_state.txt`, `target_prices.txt`, and `target_zones.txt`. - M15 confirmation uses `CopyRates(_Symbol, PERIOD_M15, OHLC_START_SHIFT, M15_CONFIRM_BARS, rates)`. ## 3. Parameters - `lot_size = 0.01`: Standard order volume. - `spread_limit = 60`: Maximum allowed spread in points. - `input_entry_magic_number = 10001`: Magic number assigned to pending orders. - `input_slippage_points = 10`: Allowed order deviation in points. - `input_position_limit = 10`: Limit for same-symbol/same-magic pending orders plus positions. - `use_split_entry_zone = false`: Enables split entries from the H1 prediction zone. - `split_entry_count = 3`: Number of split entry orders. - `split_lot_mode = SPLIT_LOT_TOTAL`: Total-volume split or fixed-volume split. - `input_cancel_retry_cooldown_seconds = 60`: Ticket-level retry cooldown after pending cancellation failures. - `use_m15_entry_filter = true`: Enables M15 closed-bar confirmation. - `input_entry_max_candidate_age_minutes = 120`: Maximum age for using an H1 candidate for new execution. ## 4. Entry And Exit Conditions - New pending orders are sent only after spread, H4 state, H1 candidate, M15 timing, price consistency, broker distance, volume, and same-symbol/same-magic limit checks pass. - Pending orders receive `input_entry_magic_number`. - The entry EA cancels expired pending orders, pending orders that conflict with the refreshed H4 state, and stale split-entry pending orders. - Filled-position SL updates, trailing, and time-based exits are not performed by this EA. ## 5. Risk Management - The order limit counts only pending orders and positions matching `_Symbol` and `input_entry_magic_number`. - Python process markers, process IDs, done files, and timeouts are monitored to prevent duplicate launches and stale-result reuse. - `OrderSend` return values and `MqlTradeResult.retcode` are checked and logged. - Because the design assumes hedging accounts, per-ticket position management is handled by `HITPositionManagerEA.mq5`. ## 6. Unit Test Scope - In the Strategy Tester, this EA is tested for pending-order creation, expired pending cancellation, and H4-state mismatch cancellation. - Position management behavior is outside this EA's unit-test scope. - Python linkage filenames include `_Symbol` and `input_entry_magic_number` to preserve reproducibility. ## 7. Changelog - 2026-06-07: Split entry responsibilities from `HIT-EA_refactor_ver6.mq5`; moved SLTP panel and filled-position management responsibilities to `HITPositionManagerEA.mq5`.