4.1 KiB
4.1 KiB
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, andtarget_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.input_tp_multiplier = 1.25: Expands the API TP distance from the entry price. Values below1.0are clamped to1.0, and values above100.0are clamped to100.0.input_min_tp_points = 0: Minimum final TP distance in points.0disables the floor.input_max_tp_points = 0: Maximum expanded TP distance in points.0disables the cap. The EA never makes the final TP closer than the API-provided TP distance.
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.
- Before order submission, TP is recalculated from the distance between entry and the API TP, multiplied by
input_tp_multiplier. Buy strategies place the final TP above entry, and Sell strategies place it below entry. - Split entries recalculate the final TP separately for each slot, using that slot's entry price.
- 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
_Symbolandinput_entry_magic_number. - Python process markers, process IDs, done files, and timeouts are monitored to prevent duplicate launches and stale-result reuse.
- If the API TP direction contradicts the Buy/Sell price rules, the EA does not repair it; the existing price-consistency checks skip the order.
OrderSendreturn values andMqlTradeResult.retcodeare 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
_Symbolandinput_entry_magic_numberto preserve reproducibility.
7. Changelog
- 2026-06-13: Added
input_tp_multiplier,input_min_tp_points, andinput_max_tp_pointsto expand API-derived TP distances for both standard orders and per-slot split entries. - 2026-06-07: Split entry responsibilities from
HIT-EA_refactor_ver6.mq5; moved SLTP panel and filled-position management responsibilities toHITPositionManagerEA.mq5.