AllowTrade miễn là Intraday không ngược bias (có thể none)

This commit is contained in:
Bell
2026-05-26 21:03:45 +07:00
parent 3cc1106ed9
commit 3fb31c4c1e
4 changed files with 39 additions and 31 deletions
+2 -2
View File
@@ -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 <ICT2026/Config.mqh>
#include <ICT2026/DailyBias.mqh>
+16 -7
View File
@@ -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()
+14 -10
View File
@@ -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);
+7 -12
View File
@@ -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;
}