From 3fb31c4c1e16ab6d262683df55c6692da2254e54 Mon Sep 17 00:00:00 2001 From: Bell Date: Tue, 26 May 2026 21:03:45 +0700 Subject: [PATCH] =?UTF-8?q?AllowTrade=20mi=E1=BB=85n=20l=C3=A0=20Intraday?= =?UTF-8?q?=20kh=C3=B4ng=20ng=C6=B0=E1=BB=A3c=20bias=20(c=C3=B3=20th?= =?UTF-8?q?=E1=BB=83=20none)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Experts/ICT_2026.mq5 | 4 ++-- Include/ICT2026/IntradayStructure.mqh | 23 ++++++++++++++++------- Include/ICT2026/LowTfTrend.mqh | 24 ++++++++++++++---------- Include/ICT2026/MssSetup.mqh | 19 +++++++------------ 4 files changed, 39 insertions(+), 31 deletions(-) diff --git a/Experts/ICT_2026.mq5 b/Experts/ICT_2026.mq5 index 327d15f..3308d99 100644 --- a/Experts/ICT_2026.mq5 +++ b/Experts/ICT_2026.mq5 @@ -3,8 +3,8 @@ //| BOS = Continue | CHoCH = Reversal | //+------------------------------------------------------------------+ #property copyright "ICT 2026" -#property version "1.168" -#property description "ICT2026 MSS | Partial close 50% + SL→BE khi giá đạt swing iL0/iH0 (TP gồng xa hơn)" +#property version "1.170" +#property description "ICT2026 MSS | Pipeline gate=Bias, Entry gate=AllowTrade — track MSS cả khi intraday ngược, chỉ block entry" #include #include diff --git a/Include/ICT2026/IntradayStructure.mqh b/Include/ICT2026/IntradayStructure.mqh index 75c3913..c60b49e 100644 --- a/Include/ICT2026/IntradayStructure.mqh +++ b/Include/ICT2026/IntradayStructure.mqh @@ -62,16 +62,25 @@ void IctIntraday_SyncFromCtx(IctSwingSet &sw, const ENUM_ICT_STRUCT pivotStruct) } } -// Up/Bull sớm đều là ICT_TREND_UP; Down/Bear sớm đều là ICT_TREND_DOWN -// → bật sớm ngay khi H1 CHoCH, không cần đợi HH-HL/LH-LL rõ +// Bias làm chủ đạo: AllowTrade chỉ block khi Intraday CONFIRMED NGƯỢC chiều Bias. +// Intraday NONE (đang transition / chưa rõ) → vẫn allow theo Bias. +// BULL bias + UP trend → allow ✓ +// BULL bias + NONE trend → allow ✓ (transition, không ngược) +// BULL bias + DOWN trend → BLOCK ✗ (ngược chiều rõ ràng) +// BEAR bias + DOWN trend → allow ✓ +// BEAR bias + NONE trend → allow ✓ +// BEAR bias + UP trend → BLOCK ✗ +// NONE bias → BLOCK ✗ (không có direction) bool IctIntraday_TrendAlignsWithBias(const ENUM_ICT_BIAS bias, const ENUM_ICT_TREND trend) { - if(bias == ICT_BIAS_BULL && trend == ICT_TREND_UP) - return true; - if(bias == ICT_BIAS_BEAR && trend == ICT_TREND_DOWN) - return true; - return false; + if(bias == ICT_BIAS_NONE) + return false; + if(bias == ICT_BIAS_BULL && trend == ICT_TREND_DOWN) + return false; + if(bias == ICT_BIAS_BEAR && trend == ICT_TREND_UP) + return false; + return true; } void IctIntraday_UpdateAllowTrade() diff --git a/Include/ICT2026/LowTfTrend.mqh b/Include/ICT2026/LowTfTrend.mqh index 2be52e8..87c3ff1 100644 --- a/Include/ICT2026/LowTfTrend.mqh +++ b/Include/ICT2026/LowTfTrend.mqh @@ -49,22 +49,26 @@ bool IctLowTfTrend_Update(const string sym, const bool force = false) IctIntraday_UpdateAllowTrade(); IctFvg_UpdateAll(sym, tf); - static bool s_prevAllowTrade = false; - const bool allowNow = g_ictIntraday.isAllowTrade; - const bool allowJustOn = (allowNow && !s_prevAllowTrade); - s_prevAllowTrade = allowNow; + // Pipeline gate = Bias rõ ràng (không gate theo Intraday trend). + // → POI scan + MSS pipeline chạy liên tục trong giai đoạn intraday transition + // → Entry vẫn bị chặn bởi isAllowTrade trong IctMssEntry_Update + static bool s_prevBiasOk = false; + const bool biasOk = (g_ictDailyBias.bias != ICT_BIAS_NONE); + const bool biasJustOn = (biasOk && !s_prevBiasOk); + s_prevBiasOk = biasOk; - if(allowNow) + if(biasOk) { const ENUM_ICT_FVG_SIDE side = IctFvgSideFromBias(g_ictDailyBias.bias); - IctFvg_ScanNew(sym, tf, side, force || allowJustOn); - g_ictLowTf.displayReason = StringFormat("H1 POI %d avail / %d FVG | scan %s", + IctFvg_ScanNew(sym, tf, side, force || biasJustOn); + const string allowTag = g_ictIntraday.isAllowTrade ? "" : " | AllowEntry=NO"; + g_ictLowTf.displayReason = StringFormat("H1 POI %d avail / %d FVG | scan %s%s", IctMss_CountH1PoiEligible(), g_ictFvgCount, - IctFvgSideText(side)); + IctFvgSideText(side), allowTag); } else { - g_ictLowTf.displayReason = "IsAllowTrade=false — giữ FVG đã khóa"; + g_ictLowTf.displayReason = "Bias none — giữ FVG đã khóa"; } g_ictLowTf.activeCount = g_ictFvgCount; @@ -124,7 +128,7 @@ void IctLowTfTrend_TickRefresh(const string sym) MathAbs(g_ictFvgZones[i].pdLow - oldPdLo[i]) > _Point) dirty = true; } - if(g_ictIntraday.isAllowTrade) + if(g_ictDailyBias.bias != ICT_BIAS_NONE) { const ENUM_ICT_MSS_PHASE prevMss = g_ictLowTf.mss.phase; IctMss_Update(sym); diff --git a/Include/ICT2026/MssSetup.mqh b/Include/ICT2026/MssSetup.mqh index 86f854b..7ad0110 100644 --- a/Include/ICT2026/MssSetup.mqh +++ b/Include/ICT2026/MssSetup.mqh @@ -740,7 +740,12 @@ void IctMss_Update(const string sym) IctMss_CheckH1WatchInvalidation(sym); - if(!g_ictIntraday.isAllowTrade) + // Pipeline gate = Bias rõ ràng (KHÔNG gate theo Intraday trend). + // → POI scan + MSS detect chạy liên tục trong giai đoạn intraday transition + // → Entry vẫn bị chặn bởi isAllowTrade trong IctMssEntry_Update + const ENUM_TIMEFRAMES cTf = InpConfirmTf; + const ENUM_ICT_FVG_SIDE wantSide = IctFvgSideFromBias(g_ictDailyBias.bias); + if(wantSide == ICT_FVG_NONE) { if(g_ictLowTf.mss.phase != ICT_MSS_IDLE) { @@ -748,17 +753,7 @@ void IctMss_Update(const string sym) g_ictLowTf.mss.h1WatchFvgId = g_ictLowTf.mss.h1FvgId; IctMss_ResetPipelineKeepWatch(); } - if(StringFind(g_ictLowTf.mss.displayReason, "FVG Used") != 0) - g_ictLowTf.mss.displayReason = "AllowTrade=false (H1 lệch Bias — MSS tạm dừng)"; - return; - } - - const ENUM_TIMEFRAMES cTf = InpConfirmTf; - const ENUM_ICT_FVG_SIDE wantSide = IctFvgSideFromBias(g_ictDailyBias.bias); - if(wantSide == ICT_FVG_NONE) - { - IctMss_ResetState(); - g_ictLowTf.mss.displayReason = "Bias none"; + g_ictLowTf.mss.displayReason = "Bias none — MSS pipeline tạm dừng"; return; }