Refactor EA codebase and update project docs
This commit is contained in:
@@ -28,6 +28,14 @@ The two EAs coordinate through matching `_Symbol` and `input_entry_magic_number`
|
||||
- `input_tp_multiplier = 1.25`: Expands the API TP distance from the entry price. Values below `1.0` are clamped to `1.0`, and values above `100.0` are clamped to `100.0`.
|
||||
- `input_min_tp_points = 0`: Minimum final TP distance in points. `0` disables the floor.
|
||||
- `input_max_tp_points = 0`: Maximum expanded TP distance in points. `0` disables the cap. The EA never makes the final TP closer than the API-provided TP distance.
|
||||
- `input_range_breakout_guard_enabled = true`: Cancels adverse reversal Limit orders during range breakouts and temporarily blocks new ones.
|
||||
- `input_range_breakout_guard_timeframe = PERIOD_M15`: Timeframe used by the range-breakout monitor.
|
||||
- `input_range_breakout_lookback_bars = 20`: Closed-bar count used for range high/low and average range.
|
||||
- `input_range_breakout_max_width_multiplier = 6.0`: Maximum allowed range width versus average range. `0` disables the width filter.
|
||||
- `input_range_breakout_buffer_multiplier = 0.20`: Average-range multiplier used as the confirmed-breakout buffer.
|
||||
- `input_range_breakout_near_multiplier = 0.50`: Average-range multiplier used as the pre-breakout proximity band.
|
||||
- `input_range_breakout_body_multiplier = 1.50`: Required latest closed-bar body multiple for momentum warning.
|
||||
- `input_range_breakout_cooldown_bars = 4`: Number of monitor-timeframe bars to block adverse Limit entries after detection.
|
||||
|
||||
## 4. Entry And Exit Conditions
|
||||
|
||||
@@ -36,6 +44,7 @@ The two EAs coordinate through matching `_Symbol` and `input_entry_magic_number`
|
||||
- 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.
|
||||
- When the range-breakout guard is enabled, upward breakout warning/confirmation cancels existing T4 Sell Limit orders and blocks new T4 entries until cooldown expiry. Downward breakout warning/confirmation cancels existing T2 Buy Limit orders and blocks new T2 entries.
|
||||
- Filled-position SL updates, trailing, and time-based exits are not performed by this EA.
|
||||
|
||||
## 5. Risk Management
|
||||
@@ -43,6 +52,7 @@ The two EAs coordinate through matching `_Symbol` and `input_entry_magic_number`
|
||||
- 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.
|
||||
- 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.
|
||||
- The range-breakout guard only touches pending orders matching `_Symbol` and `input_entry_magic_number`; upward breakouts cancel T4 Sell Limit only, and downward breakouts cancel T2 Buy Limit only.
|
||||
- `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`.
|
||||
|
||||
@@ -54,5 +64,6 @@ The two EAs coordinate through matching `_Symbol` and `input_entry_magic_number`
|
||||
|
||||
## 7. Changelog
|
||||
|
||||
- 2026-06-13: Connected the range-breakout guard from `HIT-EA_refactor_ver6.mq5` to the entry EA, including T4 Sell Limit retreat on upward breakouts, T2 Buy Limit retreat on downward breakouts, and cooldown-based new-entry blocking.
|
||||
- 2026-06-13: Added `input_tp_multiplier`, `input_min_tp_points`, and `input_max_tp_points` to 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 to `HITPositionManagerEA.mq5`.
|
||||
|
||||
@@ -28,6 +28,14 @@
|
||||
- `input_tp_multiplier = 1.25`: APIから取得したTP距離を、エントリー価格からの距離ベースで拡大する倍率。`1.0` 未満は `1.0`、`100.0` 超は `100.0` に丸めます。
|
||||
- `input_min_tp_points = 0`: 拡大後TP距離の最小値(point)。`0` の場合は無効です。
|
||||
- `input_max_tp_points = 0`: 拡大後TP距離の最大値(point)。`0` の場合は無効です。ただしAPI由来TPより近くなる場合は縮小せず、API距離を維持します。
|
||||
- `input_range_breakout_guard_enabled = true`: レンジ上抜け/下抜け時に逆方向の逆張りLimit注文を退避し、新規発注も一時停止するか。
|
||||
- `input_range_breakout_guard_timeframe = PERIOD_M15`: レンジブレイクを監視する時間足。
|
||||
- `input_range_breakout_lookback_bars = 20`: レンジ高値・安値と平均レンジを計算する確定足本数。
|
||||
- `input_range_breakout_max_width_multiplier = 6.0`: 平均レンジに対して許容する最大レンジ幅。`0` の場合はレンジ幅フィルタを無効化します。
|
||||
- `input_range_breakout_buffer_multiplier = 0.20`: 確定ブレイク判定に使う平均レンジ倍率。
|
||||
- `input_range_breakout_near_multiplier = 0.50`: ブレイク警戒判定に使うレンジ境界への接近幅倍率。
|
||||
- `input_range_breakout_body_multiplier = 1.50`: ブレイク警戒に必要な直近確定足実体の平均実体倍率。
|
||||
- `input_range_breakout_cooldown_bars = 4`: ブレイク検知後に逆方向Limitの新規発注を停止する足数。
|
||||
|
||||
## 4. エントリー/エグジット条件
|
||||
|
||||
@@ -36,6 +44,7 @@
|
||||
- 分割エントリーではslotごとのエントリー価格を基準に、各slotの最終TPを個別に計算します。
|
||||
- pending注文には `input_entry_magic_number` を付与します。
|
||||
- H4状態と矛盾するpending注文、期限切れpending注文、古い分割pending注文は発注EAが取消します。
|
||||
- レンジブレイクガードがONの場合、M15監視足で上方向ブレイク警戒/確定を検出すると既存T4 Sell Limitを取消し、T4新規発注をクールダウン終了まで停止します。下方向ブレイクでは既存T2 Buy Limitを取消し、T2新規発注を停止します。
|
||||
- 約定後ポジションのSL変更、時間決済、トレーリングは発注EAでは行いません。
|
||||
|
||||
## 5. リスク管理
|
||||
@@ -43,6 +52,7 @@
|
||||
- 発注上限は口座全体ではなく `_Symbol` と `input_entry_magic_number` が一致するpending注文 + ポジションで判定します。
|
||||
- Python連携は起動中/完了ファイルとプロセスIDを監視し、二重起動と古い結果の再利用を抑止します。
|
||||
- API由来TPの方向がBuy/Sell条件と逆の場合、EAは方向を補正せず既存の価格整合チェックで発注を見送ります。
|
||||
- レンジブレイクガードは `_Symbol` と `input_entry_magic_number` が一致するpending注文だけを対象にし、上方向ではT4 Sell Limit、下方向ではT2 Buy Limitのみを取消します。
|
||||
- `OrderSend` の戻り値と `MqlTradeResult.retcode` を確認し、失敗時はエラーまたはretcodeをログに出します。
|
||||
- hedging口座前提のため、約定後の複数ticket管理は `HITPositionManagerEA.mq5` が担当します。
|
||||
|
||||
@@ -54,5 +64,6 @@
|
||||
|
||||
## 7. 変更履歴
|
||||
|
||||
- 2026-06-13: `HIT-EA_refactor_ver6.mq5` と同等のレンジブレイクガードを発注EAへ接続。レンジ上抜け時のT4 Sell Limit退避、レンジ下抜け時のT2 Buy Limit退避、およびクールダウン中の新規発注停止を反映。
|
||||
- 2026-06-13: API由来TPをエントリー価格からの距離ベースで拡大する `input_tp_multiplier`, `input_min_tp_points`, `input_max_tp_points` を追加し、通常注文と分割slotごとの最終TP計算に反映。
|
||||
- 2026-06-07: `HIT-EA_refactor_ver6.mq5` から発注責務を分離し、SLTPパネルとポジション管理を `HITPositionManagerEA.mq5` へ移管する仕様を追加。
|
||||
|
||||
@@ -19,11 +19,21 @@ The managed set is limited to positions whose `POSITION_SYMBOL` equals `_Symbol`
|
||||
- `input_position_close_after_h1_bars = 12`: Time-based close threshold in H1 bars. `0` disables it.
|
||||
- `input_sltp_manager_enabled = false`: Master switch for SLTP management.
|
||||
- `input_sltp_show_panel = true`: Shows the SLTP control panel.
|
||||
- `input_sltp_use_breakeven`: Standard breakeven.
|
||||
- `input_sltp_use_elapsed_breakeven`: Elapsed-time breakeven.
|
||||
- `input_sltp_use_active_trailing`: Active trailing.
|
||||
- `input_sltp_use_tp_progress_stop`: TP-progress stop.
|
||||
- `input_sltp_use_high_volatility_limit`: High-volatility stop tightening.
|
||||
- `input_sltp_use_breakeven = false`: Standard breakeven.
|
||||
- `input_sltp_breakeven_trigger_pips = 30.0`: Profit threshold for standard breakeven.
|
||||
- `input_sltp_breakeven_buffer_pips = 3.0`: Profit-side entry buffer used by standard breakeven.
|
||||
- `input_sltp_use_elapsed_breakeven = false`: Elapsed-time breakeven.
|
||||
- `input_sltp_elapsed_breakeven_hours = 4.0`: Holding time required before elapsed-time breakeven is allowed.
|
||||
- `input_sltp_elapsed_breakeven_buffer_pips = 3.0`: Profit-side entry buffer used by elapsed-time breakeven.
|
||||
- `input_sltp_use_active_trailing = false`: Active trailing.
|
||||
- `input_sltp_active_breakeven_pips = 30.0`: Profit threshold that starts active trailing.
|
||||
- `input_sltp_active_stop_loss_offset_pips = 5.0`: Initial locked profit offset from entry.
|
||||
- `input_sltp_active_step_trigger_pips = 10.0`: Additional profit interval required for each SL step.
|
||||
- `input_sltp_active_step_move_pips = 5.0`: SL movement added per completed step.
|
||||
- `input_sltp_use_tp_progress_stop = false`: TP-progress stop.
|
||||
- `input_sltp_tp_progress_trigger_percent = 70.0`: TP progress required before the SL lock is applied.
|
||||
- `input_sltp_tp_progress_sl_lock_percent = 30.0`: Entry-to-TP distance percentage locked by SL.
|
||||
- `input_sltp_use_high_volatility_limit = false`: High-volatility stop tightening.
|
||||
|
||||
## 4. Entry And Exit Conditions
|
||||
|
||||
@@ -48,4 +58,5 @@ The managed set is limited to positions whose `POSITION_SYMBOL` equals `_Symbol`
|
||||
|
||||
## 7. Changelog
|
||||
|
||||
- 2026-06-13: Synchronized SLTP input defaults with `HIT-EA_refactor_ver6.mq5` and documented each default value.
|
||||
- 2026-06-07: Split position-management responsibilities from `HIT-EA_refactor_ver6.mq5` and defined a hedging-account, ticket-based manager EA.
|
||||
|
||||
@@ -19,11 +19,21 @@
|
||||
- `input_position_close_after_h1_bars = 12`: 保有時間決済のH1本数。0で無効。
|
||||
- `input_sltp_manager_enabled = false`: SLTP管理全体のON/OFF。
|
||||
- `input_sltp_show_panel = true`: SLTP操作パネルを表示するか。
|
||||
- `input_sltp_use_breakeven`: 通常ブレークイーブン。
|
||||
- `input_sltp_use_elapsed_breakeven`: 保有時間ベースのブレークイーブン。
|
||||
- `input_sltp_use_active_trailing`: アクティブトレーリング。
|
||||
- `input_sltp_use_tp_progress_stop`: TP進捗率SL。
|
||||
- `input_sltp_use_high_volatility_limit`: 急変時SL引き締め。
|
||||
- `input_sltp_use_breakeven = false`: 通常ブレークイーブン。
|
||||
- `input_sltp_breakeven_trigger_pips = 30.0`: 通常ブレークイーブン開始pips。
|
||||
- `input_sltp_breakeven_buffer_pips = 3.0`: 通常ブレークイーブン時の利益方向バッファpips。
|
||||
- `input_sltp_use_elapsed_breakeven = false`: 保有時間ベースのブレークイーブン。
|
||||
- `input_sltp_elapsed_breakeven_hours = 4.0`: 保有時間ベースのブレークイーブン開始時間。
|
||||
- `input_sltp_elapsed_breakeven_buffer_pips = 3.0`: 保有時間ベースのブレークイーブン時の利益方向バッファpips。
|
||||
- `input_sltp_use_active_trailing = false`: アクティブトレーリング。
|
||||
- `input_sltp_active_breakeven_pips = 30.0`: アクティブトレーリング開始pips。
|
||||
- `input_sltp_active_stop_loss_offset_pips = 5.0`: 開始時に建値から固定する利益pips。
|
||||
- `input_sltp_active_step_trigger_pips = 10.0`: SLを1段進めるために必要な追加利益pips。
|
||||
- `input_sltp_active_step_move_pips = 5.0`: 1段ごとにSLを利益方向へ動かすpips。
|
||||
- `input_sltp_use_tp_progress_stop = false`: TP進捗率SL。
|
||||
- `input_sltp_tp_progress_trigger_percent = 70.0`: TP進捗率SL開始率。
|
||||
- `input_sltp_tp_progress_sl_lock_percent = 30.0`: 建値からTPまでの距離のうちSLで固定する割合。
|
||||
- `input_sltp_use_high_volatility_limit = false`: 急変時SL引き締め。
|
||||
|
||||
## 4. エントリー/エグジット条件
|
||||
|
||||
@@ -48,4 +58,5 @@
|
||||
|
||||
## 7. 変更履歴
|
||||
|
||||
- 2026-06-13: SLTP関連inputの既定値を `HIT-EA_refactor_ver6.mq5` と同じ初期状態に同期し、仕様書へ各既定値を明記。
|
||||
- 2026-06-07: `HIT-EA_refactor_ver6.mq5` からポジション管理責務を分離し、hedging口座専用のticket単位管理EAとして新規定義。
|
||||
|
||||
Reference in New Issue
Block a user