last ...
This commit is contained in:
@@ -1179,7 +1179,7 @@ class XCMarketPatternDetector : public XCBase
|
||||
iBar,
|
||||
ob,
|
||||
true, // Force FVG Bar Type ...
|
||||
true // Force OB First Two Bar InDirection ...
|
||||
true // Force OB First Two Bar InDirection ...
|
||||
);
|
||||
if (!has)
|
||||
{
|
||||
@@ -1224,6 +1224,151 @@ class XCMarketPatternDetector : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Liquidity Sweeps ...
|
||||
*
|
||||
* @param bar: XOHCL, Specified Bar ...
|
||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
||||
* @param sweeperBar: XOHCL, reference for Holding Sweeper Bar ...
|
||||
* @param zone: XBoxZone, reference for Holding new Support/Resistance after Liquidity Sweeped ...
|
||||
* @param sweepedLiquidity: XBoxZone, reference for Holding Sweeped Liquidity Zone ...
|
||||
* @param liquidityLoopbackLength: int, Max Allowed Length to Sweep a Liquidity ...
|
||||
* @param zoneValidationLength: int, Liquidity Detection Validatio Length ...
|
||||
* @param zodeMaxAllowedLoopback: int, Max Allowed Loopback Length to Detect Liquidity ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasSweepedLiquidity(
|
||||
XOHCL &bar,
|
||||
ENUM_X_DIRECTION &dir,
|
||||
XOHCL &sweeperBar,
|
||||
XBoxZone &zone,
|
||||
XBoxZone &sweepedLiquidity,
|
||||
int liquidityLoopbackLength = 21,
|
||||
int zoneValidationLength = 21,
|
||||
int zodeMaxAllowedLoopback = 1500 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Prepare ...
|
||||
zone.Clean();
|
||||
sweeperBar.Clean();
|
||||
CleanDirection(dir);
|
||||
sweepedLiquidity.Clean();
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
zoneValidationLength = NormalizeInt(zoneValidationLength, 7);
|
||||
liquidityLoopbackLength = NormalizeInt(liquidityLoopbackLength, 5);
|
||||
zodeMaxAllowedLoopback = NormalizeInt(zodeMaxAllowedLoopback, 21, 1500);
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL supportBar;
|
||||
XOHCL resistanceBar;
|
||||
datetime barBeofreOn = bar.BeforeOn();
|
||||
|
||||
//
|
||||
// Current Bar must has Support / Resistance ...
|
||||
|
||||
//
|
||||
// Support ...
|
||||
bool hasSupport = HasSupport(
|
||||
bar,
|
||||
supportBar,
|
||||
zoneValidationLength,
|
||||
zodeMaxAllowedLoopback //
|
||||
);
|
||||
|
||||
//
|
||||
// Validate Fresh Support ...
|
||||
hasSupport =
|
||||
hasSupport &&
|
||||
supportBar.time == barBeofreOn;
|
||||
|
||||
//
|
||||
// Validate Support Box Exists ...
|
||||
hasSupport =
|
||||
hasSupport &&
|
||||
ToSupportBox(supportBar, zone);
|
||||
|
||||
//
|
||||
// Resistance ...
|
||||
bool hasResistance = HasResistance(
|
||||
bar,
|
||||
resistanceBar,
|
||||
zoneValidationLength,
|
||||
zodeMaxAllowedLoopback //
|
||||
);
|
||||
|
||||
//
|
||||
// Validate Fresh Resistance ...
|
||||
hasResistance =
|
||||
hasResistance &&
|
||||
resistanceBar.time == barBeofreOn;
|
||||
|
||||
//
|
||||
// Validate Resistance Box Existx ...
|
||||
hasResistance =
|
||||
hasResistance &&
|
||||
ToResistanceBox(resistanceBar, zone);
|
||||
|
||||
//
|
||||
result =
|
||||
hasSupport ||
|
||||
hasResistance;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
zone.Clean();
|
||||
sweeperBar.Clean();
|
||||
supportBar.Clean();
|
||||
CleanDirection(dir);
|
||||
resistanceBar.Clean();
|
||||
sweepedLiquidity.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = HasDirection(dir);
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
zone.Clean();
|
||||
sweeperBar.Clean();
|
||||
CleanDirection(dir);
|
||||
sweepedLiquidity.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Trending ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user