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
+157
View File
@@ -2280,6 +2280,80 @@ class XCOrderBlock : public XCBarZone
return result;
}
/**
* Check Order Block Validation ...
*
* @return ( bool )
*/
bool IsValidOrderBlock()
{
//
bool result = false;
//
result = IsValid();
if (!result)
{
return result;
}
//
XOHCL breakerBar;
result = DetectBreakerBar(breakerBar);
if (!result)
{
return result;
}
int breakerBarIndex = breakerBar.Index();
//
XOHCL huntedBar;
bool isHunted = IsHunted(huntedBar);
result = !isHunted;
if (!result)
{
return result;
}
//
bool isBullish = IsBullish();
//
for (int i = breakerBarIndex - 1; i >= 0; i--)
{
//
XOHCL iBar;
result = iBar.Init(
breakerBar.symbol,
breakerBar.period,
i //
);
if (!result)
{
continue;
}
//
double price =
isBullish
? iBar.low
: iBar.high;
//
result =
isBullish
? price > Upper()
: price < Lower();
if (!result)
{
return result;
}
}
//
return result;
}
//
// Overrides ...
@@ -6050,6 +6124,89 @@ struct XMarketStructure
//
};
struct XFVGOrderBlock
{
//
// Props ...
XCOrderBlock *orderBlock;
XCFVG *fairValueGap;
//
XFVGOrderBlock()
{
Clean();
}
/**
* Cleanup Model ...
*/
void Clean()
{
//
orderBlock = NULL;
fairValueGap = NULL;
}
/**
* Validate Model ...
*
* @return ( bool )
*/
bool IsValid()
{
//
bool result = false;
//
result =
//
orderBlock != NULL &&
fairValueGap != NULL &&
((orderBlock.IsBullish() &&
fairValueGap.IsBullish()) ||
((orderBlock.IsBearish() &&
fairValueGap.IsBearish())))
//
;
//
return result;
}
/**
* Get Model Direction ...
*
* @param dir: ENUM_X_DIRECTION member ...
*
* @return ( bool )
*/
bool GetDirection(
ENUM_X_DIRECTION &dir //
)
{
//
bool result = false;
//
dir = X_DIRECTION_NONE;
//
result = IsValid();
if (!result)
{
return result;
}
//
dir = orderBlock.IsBullish()
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
return result;
}
};
//
// Extensions ...