Refactor EA codebase and update project docs

This commit is contained in:
Hiroaki86
2026-06-13 23:22:06 +09:00
parent f9012e19e2
commit 7b11d44d66
13 changed files with 80 additions and 3486 deletions
+17 -15
View File
@@ -5,7 +5,7 @@
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, nanpin-martin.com"
#property link "https://nanpin-martin.com/"
#property version "1.10"
#property version "1.11"
//+------------------------------------------------------------------+
//| バッチファイル実行用の設定
@@ -97,12 +97,12 @@ enum SplitLotMode
input double lot_size = 0.01; // ロット数
input double spread_limit = 60; // 許容スプレッド(point)
input int input_entry_magic_number = 10001; // 発注EAのマジックナンバー
input ulong input_slippage_points = 20; // 許容スリッページ(point)
input ulong input_slippage_points = 10; // 許容スリッページ(point)
input int initial_order = 0; // 互換性維持用。起動時H4/H1再構築は常時実行
input int input_position_limit = 10; // 自EAの未約定注文+ポジション上限
input bool use_split_entry_zone = false; // H1予測ゾーンで分割エントリーする
input int split_entry_count = 3; // 分割エントリー本数(1..10)
input SplitLotMode split_lot_mode = SPLIT_LOT_FIXED; // 分割ロット配分モード
input SplitLotMode split_lot_mode = SPLIT_LOT_TOTAL; // 分割ロット配分モード
input double split_total_lot_size = 0.09; // 総量分割モードの合計ロット
input double split_fixed_lot_size = 0.01; // 固定ロットモードの1注文ロット
input bool cancel_old_split_pending_on_new_zone = true; // 新ゾーン読込時に旧分割pendingを取消
@@ -118,6 +118,14 @@ input int input_entry_max_candidate_age_minutes = 120; // H1候補価格を
input double input_tp_multiplier = 1.25; // TP distance multiplier (1.0=no expansion)
input int input_min_tp_points = 0; // Minimum TP distance in points (0=disabled)
input int input_max_tp_points = 0; // Maximum expanded TP distance in points (0=disabled)
input bool input_range_breakout_guard_enabled = true; // レンジ上抜け/下抜け時に逆張りLimitを退避
input ENUM_TIMEFRAMES input_range_breakout_guard_timeframe = PERIOD_M15; // レンジブレイク監視足
input int input_range_breakout_lookback_bars = 20; // レンジ高値安値の参照本数
input double input_range_breakout_max_width_multiplier = 6.0; // 平均レンジに対する最大レンジ幅
input double input_range_breakout_buffer_multiplier = 0.20; // ブレイク確定バッファ倍率
input double input_range_breakout_near_multiplier = 0.50; // ブレイク警戒の境界接近幅倍率
input double input_range_breakout_body_multiplier = 1.50; // 勢い判定の平均実体倍率
input int input_range_breakout_cooldown_bars = 4; // 逆張りLimit停止を継続する足数
// Existing shared HIT include files read these runtime globals.
int magic_number = 10001;
@@ -200,18 +208,9 @@ bool g_bars_M15_check = false;
ulong g_cancel_retry_tickets[];
datetime g_cancel_retry_at[];
// Compatibility settings for the shared trade manager.
// HITEntryEA does not run the range-breakout monitor, so the guard remains disabled.
bool input_range_breakout_guard_enabled = false;
ENUM_TIMEFRAMES input_range_breakout_guard_timeframe = PERIOD_M15;
int input_range_breakout_lookback_bars = 20;
double input_range_breakout_max_width_multiplier = 6.0;
double input_range_breakout_buffer_multiplier = 0.20;
double input_range_breakout_near_multiplier = 0.50;
double input_range_breakout_body_multiplier = 1.50;
int input_range_breakout_cooldown_bars = 4;
int g_range_breakout_guard_direction = RANGE_BREAKOUT_NONE;
datetime g_range_breakout_guard_until = 0;
// Range-breakout guard state for adverse reversal Limit orders.
int g_range_breakout_guard_direction = RANGE_BREAKOUT_NONE;
datetime g_range_breakout_guard_until = 0;
// ティックごとの価格情報
struct TickContext
@@ -442,6 +441,9 @@ void OnTick()
// Expired pending orders are managed by the entry EA before any Python wait state.
ManageExpiredEntryOrders();
// Delete and pause adverse limit orders before breakout spikes can fill them.
ManageRangeBreakoutLimitGuard(ctx);
// 外部Pythonがdoneを返さない場合に、一定時間で待機状態を解除して再実行対象にする。
RecoverTimedOutPythonProcesses();