Files
EA_with_Python/docs/MyProject/HITPositionManagerTestHarness_spec_en.md
T
2026-06-07 22:06:30 +09:00

2.2 KiB

HITPositionManagerTestHarness Specification

1. Overview

HITPositionManagerTestHarness.mq5 is a Strategy Tester-only EA for unit-testing the management logic used by HITPositionManagerEA.mq5. It is not intended for live trading. It fails initialization outside MQL_TESTER and on non-hedging accounts.

The harness seeds test positions, then calls the same production CSLTPManager and CHITPositionLifecycleManager classes used by the manager EA.

2. Indicators

  • No standard or custom indicators are used.
  • The management logic uses the current tick, selected position data, and symbol trading constraints.

3. Parameters

  • input_managed_magic_number = 10001: Magic number for managed test positions.
  • input_control_magic_number = 20002: Magic number for a different-magic control position.
  • input_slippage_points = 10: Allowed deviation for seed orders, closes, and SL modifications.
  • input_test_lot_size = 0.01: Test position volume.
  • input_seed_managed_buy = true: Seeds a managed BUY position.
  • input_seed_managed_sell = true: Seeds a managed SELL position.
  • input_seed_control_position = true: Seeds a different-magic control position.
  • input_position_close_after_h1_bars = 12: Time-exit threshold in H1 bars.
  • input_sltp_*: Same SLTP settings as the production manager EA.

4. Entry And Exit Conditions

  • On the first tick, the harness creates the configured managed BUY, managed SELL, and different-magic BUY positions.
  • After seeding, it runs the same management sequence as production: time exits, SLTP management, and high-volatility stop tightening.
  • The different-magic control position is expected to remain unmanaged.

5. Risk Management

  • This EA is tester-only and does not run in live mode.
  • Test volume is normalized to SYMBOL_VOLUME_MIN/MAX/STEP.
  • The target filter is the same as production: _Symbol + input_managed_magic_number.

6. Unit Test Scope

  • The harness keeps test-only order creation out of the production manager EA.
  • It verifies buy/sell coexistence, multiple-ticket handling, magic mismatch exclusion, time exits, and SL updates.

7. Changelog

  • 2026-06-07: Created as the Strategy Tester unit-test harness for HITPositionManagerEA.mq5.