This commit is contained in:
2025-01-07 02:57:14 +03:30
parent 65b7a2ca7f
commit 3d95220cc7
3 changed files with 392 additions and 22 deletions
+220 -20
View File
@@ -720,11 +720,13 @@ ENUM_X_121_SMC_PROVIDERS ParseProvider(string value)
//
bool TestPOIState(
XCPOIDrawer *drawer,
ENUM_X_DIRECTION forDir, // Test For Specified Direction ...
XPOIState &biggerState, // Bigger TF POI(s) ...
XPOIState &midState, // Mid TF POI(s) ...
XPOIState &triggerState, // Trigger TF POI(s) ...
int barIndex = 0 // Bar Index ...
ENUM_X_DIRECTION &forDir, // Test For Specified Direction ...
XFVGOrderBlock &bullishOrderBlocks[], // Bullish Order Blocks ...
XFVGOrderBlock &bearishOrderBlocks[], // Bearish Order Blocks ...
XPOIState &orderBlockState, // Order Block Detection TF POI(s) ...
XPOIState &fairValueGapState, // Fair Value Gap Detection TF POI(s) ...
XPOIState &triggerState, // Trigger TF POI(s) ...
int barIndex = 0 // Bar Index ...
)
{
//
@@ -736,13 +738,15 @@ bool TestPOIState(
barIndex = 0;
}
//
forDir = X_DIRECTION_NONE;
//
// Validate Args ...
result =
drawer != NULL &&
HasDirection(forDir) &&
biggerState.HasChild() &&
midState.HasChild() &&
orderBlockState.HasChild() &&
fairValueGapState.HasChild() &&
triggerState.HasChild();
if (!result)
{
@@ -750,8 +754,8 @@ bool TestPOIState(
}
//
string symbol = biggerState.symbol;
ENUM_TIMEFRAMES period = biggerState.period;
string symbol = orderBlockState.symbol;
ENUM_TIMEFRAMES period = orderBlockState.period;
//
// Retrieve Bars ...
@@ -769,8 +773,7 @@ bool TestPOIState(
//
// Bullish ...
XCOrderBlock *bullishOrderBlocks[];
int bullishOrderBlocksCount = biggerState.CountBullishOrderBlocks();
int bullishOrderBlocksCount = orderBlockState.CountBullishOrderBlocks();
count = bullishOrderBlocksCount;
if (IsValidSize(count))
{
@@ -778,7 +781,8 @@ bool TestPOIState(
for (int i = count - 1; i >= 0; i--)
{
//
XCOrderBlock *iOb = biggerState.bullishOrderBlocks[i];
XCFVG *iFVG = NULL;
XCOrderBlock *iOb = orderBlockState.bullishOrderBlocks[i];
iOb.To(cTime);
//
@@ -794,10 +798,74 @@ bool TestPOIState(
// Detect Order Block is Hunted Or Not ...
XOHCL huntedBar;
bool isHunted = iOb.IsHunted(huntedBar);
if (isHunted) {
if (isHunted)
{
continue;
}
//
// Check Validation of Order Block ...
bool isValid = iOb.IsValidOrderBlock();
if (!isValid)
{
continue;
}
//
// Check Order Block Has Fair Value Gap ...
int fvgsCount = fairValueGapState.CountBullishFairValueGaps();
bool hasFVG = IsValidSize(fvgsCount);
if (!hasFVG)
{
continue;
}
//
for (int j = fvgsCount - 1; j >= 0; j--)
{
//
XCFVG *jFVG = fairValueGapState.bullishFairValueGaps[j];
//
bool isValid =
//
jFVG.IsBullish()
// &&
// jFVG.From() > iOb.From() &&
// ((jFVG.Upper() > iOb.Upper() &&
// jFVG.Lower() <= iOb.Upper()) ||
// (jFVG.Upper() <= iOb.Upper() &&
// jFVG.Lower() >= iOb.Lower()))
//
;
if (isValid)
{
//
jFVG.To(cTime);
iFVG = jFVG;
break;
}
}
//
hasFVG = iFVG != NULL;
result = hasFVG;
if (!result)
{
return result;
}
//
XFVGOrderBlock iModel;
iModel.orderBlock = iOb;
iModel.fairValueGap = iFVG;
//
AddRef(
iModel,
bullishOrderBlocks //
);
//
XCBullishOrderBlockObject *iOBObject;
bool isInited = drawer.CreateBullishOrderBlock(
@@ -817,15 +885,13 @@ bool TestPOIState(
);
if (isInited)
{
Print("");
}
}
}
//
// Bearish ...
XCOrderBlock *bearishOrderBlocks[];
int bearishOrderBlocksCount = biggerState.CountBearishOrderBlocks();
int bearishOrderBlocksCount = orderBlockState.CountBearishOrderBlocks();
count = bearishOrderBlocksCount;
if (IsValidSize(count))
{
@@ -833,15 +899,127 @@ bool TestPOIState(
for (int i = count - 1; i >= 0; i--)
{
//
XCOrderBlock *iOb = biggerState.bearishOrderBlocks[i];
XCFVG *iFVG = NULL;
XCOrderBlock *iOb = orderBlockState.bearishOrderBlocks[i];
iOb.To(cTime);
//
// Find Exit Bar of Bullish OrderBlock Upper ...
XOHCL breakerBar;
bool hasBreakerBar = iOb.DetectBreakerBar(breakerBar);
if (!hasBreakerBar)
{
continue;
}
//
// Detect Order Block is Hunted Or Not ...
XOHCL huntedBar;
bool isHunted = iOb.IsHunted(huntedBar);
if (isHunted)
{
continue;
}
//
// Check Validation of Order Block ...
bool isValid = iOb.IsValidOrderBlock();
if (!isValid)
{
continue;
}
//
// Check Order Block Has Fair Value Gap ...
int fvgsCount = fairValueGapState.CountBearishFairValueGaps();
bool hasFVG = IsValidSize(fvgsCount);
if (!hasFVG)
{
continue;
}
//
for (int j = fvgsCount - 1; j >= 0; j--)
{
//
XCFVG *jFVG = fairValueGapState.bearishFairValueGaps[j];
//
bool isValid =
//
jFVG.IsBearish()
// &&
// jFVG.From() > iOb.From() &&
// jFVG.Upper() > iOb.Lower() &&
// jFVG.Lower() <= iOb.Lower()
//
;
if (isValid)
{
//
jFVG.To(cTime);
iFVG = jFVG;
break;
}
}
//
hasFVG = iFVG != NULL;
result = hasFVG;
if (!result)
{
return result;
}
//
XFVGOrderBlock iModel;
iModel.orderBlock = iOb;
iModel.fairValueGap = iFVG;
//
AddRef(
iModel,
bullishOrderBlocks //
);
//
XCBearishOrderBlockObject *iOBObject;
bool isInited = drawer.CreateBearishOrderBlock(
iOb,
iOBObject //
);
if (isInited)
{
}
//
XCOHCLObject *iBarObj;
isInited = drawer.CreateBar(
breakerBar,
iBarObj,
cTime //
);
if (isInited)
{
}
}
}
//
// Check Order Blocks ...
bullishOrderBlocksCount = ArraySize(bullishOrderBlocks);
bool hasBullishOrderBlocks = IsValidSize(bullishOrderBlocksCount);
//
// Check Order Blocks ...
bearishOrderBlocksCount = ArraySize(bearishOrderBlocks);
bool hasBearishOrderBlocks = IsValidSize(bearishOrderBlocksCount);
//
result =
//
IsValidSize(bullishOrderBlocksCount) ||
IsValidSize(bearishOrderBlocksCount)
hasBullishOrderBlocks ||
hasBearishOrderBlocks
//
;
if (!result)
@@ -849,6 +1027,28 @@ bool TestPOIState(
return result;
}
//
bool isBullish = hasBullishOrderBlocks && !hasBearishOrderBlocks;
bool isBearish = hasBearishOrderBlocks && !hasBullishOrderBlocks;
bool isAll = hasBullishOrderBlocks && hasBearishOrderBlocks;
//
forDir =
isBullish
? X_DIRECTION_BULLISH
: isBearish
? X_DIRECTION_BEARISH
: isAll
? X_DIRECTION_ALL
: X_DIRECTION_NONE;
//
result = forDir != X_DIRECTION_NONE;
if (!result)
{
return result;
}
//
return result;
}