last ...
This commit is contained in:
@@ -4531,6 +4531,55 @@ bool TestFVG(
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
else if (isPriceInsideSupplyZone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (isPriceInsideVisionSupplyZone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
upper = conditions.visionHighestSupplyZone.Upper();
|
||||||
|
lower = conditions.visionHighestSupplyZone.Lower();
|
||||||
|
|
||||||
|
//
|
||||||
|
isInsideZoneDirectionBullish = false;
|
||||||
|
isInsideZoneDirectionBearish = true;
|
||||||
|
}
|
||||||
|
else if (isPriceInsideConsolidationSupplyZone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
upper = conditions.consolidationHighestSupplyZone.Upper();
|
||||||
|
lower = conditions.consolidationHighestSupplyZone.Lower();
|
||||||
|
|
||||||
|
//
|
||||||
|
isInsideZoneDirectionBullish = false;
|
||||||
|
isInsideZoneDirectionBearish = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (isPriceInsideDemandZone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (isPriceInsideVisionDemandZone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
upper = conditions.visionLowestDemandZone.Upper();
|
||||||
|
lower = conditions.visionLowestDemandZone.Lower();
|
||||||
|
|
||||||
|
//
|
||||||
|
isInsideZoneDirectionBullish = true;
|
||||||
|
isInsideZoneDirectionBearish = false;
|
||||||
|
}
|
||||||
|
else if (isPriceInsideConsolidationDemandZone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
upper = conditions.consolidationLowestDemandZone.Upper();
|
||||||
|
lower = conditions.consolidationLowestDemandZone.Lower();
|
||||||
|
|
||||||
|
//
|
||||||
|
isInsideZoneDirectionBullish = true;
|
||||||
|
isInsideZoneDirectionBearish = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -4323,7 +4323,7 @@ class XCTicksZone : public XCTwoBarZone
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
result = endBar.IsValid() &&
|
result = endBar.IsValid() &&
|
||||||
startBar.IsValid();
|
startBar.IsValid();
|
||||||
@@ -4333,7 +4333,8 @@ class XCTicksZone : public XCTwoBarZone
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (!IsSpecifiedValid(forPeriod)) {
|
if (!IsSpecifiedValid(forPeriod))
|
||||||
|
{
|
||||||
forPeriod = endBar.period;
|
forPeriod = endBar.period;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7209,6 +7210,50 @@ bool IsBelow(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool IsReject(
|
||||||
|
ENUM_X_DIRECTION forDir,
|
||||||
|
XOHCL &bar,
|
||||||
|
T *source,
|
||||||
|
XPOIState &state,
|
||||||
|
XOHCL &swingBar,
|
||||||
|
XOHCL &rejectBar,
|
||||||
|
XOHCL &breakerBar,
|
||||||
|
XOHCL &momentumBar,
|
||||||
|
bool forceSwingRejection = true //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone sourceBox;
|
||||||
|
result = ToBox(
|
||||||
|
sourceBox,
|
||||||
|
source //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsRejectBox(
|
||||||
|
forDir,
|
||||||
|
bar,
|
||||||
|
sourceBox,
|
||||||
|
state,
|
||||||
|
swingBar,
|
||||||
|
rejectBar,
|
||||||
|
breakerBar,
|
||||||
|
momentumBar,
|
||||||
|
forceSwingRejection //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void UpdateTo(
|
void UpdateTo(
|
||||||
T *&source[],
|
T *&source[],
|
||||||
@@ -7482,6 +7527,485 @@ bool IsBelowBox(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool IsRejectBox(
|
||||||
|
ENUM_X_DIRECTION &forDir,
|
||||||
|
XOHCL &bar,
|
||||||
|
XBoxZone &box,
|
||||||
|
XPOIState &state,
|
||||||
|
XOHCL &swingBar,
|
||||||
|
XOHCL &rejectBar,
|
||||||
|
XOHCL &breakerBar,
|
||||||
|
XOHCL &momentumBar,
|
||||||
|
bool forceSwingRejection = true //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
swingBar.Clean();
|
||||||
|
rejectBar.Clean();
|
||||||
|
breakerBar.Clean();
|
||||||
|
momentumBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
result = bar.IsValid() &&
|
||||||
|
box.IsValid() &&
|
||||||
|
state.IsValid() &&
|
||||||
|
state.HasChild() &&
|
||||||
|
HasDirection(forDir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = IsBullish(forDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
double appliedPrice =
|
||||||
|
isBullish
|
||||||
|
? box.upper
|
||||||
|
: box.lower;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fetch Required Bars ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL cBar;
|
||||||
|
result = bar.GetPreviousBar(cBar);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL pBar;
|
||||||
|
result = cBar.GetPreviousBar(pBar);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL ppBar;
|
||||||
|
result = pBar.GetPreviousBar(ppBar);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Directional Swing Type ...
|
||||||
|
ENUM_X_SWING_TYPE swingType =
|
||||||
|
isBullish
|
||||||
|
? X_SWING_LOW
|
||||||
|
: X_SWING_HIGH;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSwingLow =
|
||||||
|
//
|
||||||
|
pBar.low < ppBar.low &&
|
||||||
|
pBar.low < cBar.low &&
|
||||||
|
bar.open > pBar.low &&
|
||||||
|
//
|
||||||
|
appliedPrice > pBar.low &&
|
||||||
|
appliedPrice < pBar.GetDown()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSwingHigh =
|
||||||
|
//
|
||||||
|
pBar.high > ppBar.high &&
|
||||||
|
pBar.high > cBar.high &&
|
||||||
|
bar.open < pBar.high &&
|
||||||
|
//
|
||||||
|
appliedPrice < pBar.high &&
|
||||||
|
appliedPrice > pBar.GetUp()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Force Rejected By Swing ...
|
||||||
|
if (forceSwingRejection)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = swingType == X_SWING_HIGH
|
||||||
|
? isSwingHigh
|
||||||
|
: swingType == X_SWING_LOW
|
||||||
|
? isSwingLow
|
||||||
|
: false;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasValidSwing =
|
||||||
|
isBullish
|
||||||
|
? isSwingLow
|
||||||
|
: isSwingHigh;
|
||||||
|
if (hasValidSwing)
|
||||||
|
{
|
||||||
|
swingBar = pBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCBarBreaked = IsBarBreak(
|
||||||
|
appliedPrice,
|
||||||
|
forDir,
|
||||||
|
cBar //
|
||||||
|
);
|
||||||
|
if (isCBarBreaked)
|
||||||
|
{
|
||||||
|
breakerBar = cBar;
|
||||||
|
}
|
||||||
|
bool isPBarBreaked = IsBarBreak(
|
||||||
|
appliedPrice,
|
||||||
|
forDir,
|
||||||
|
pBar //
|
||||||
|
);
|
||||||
|
if (isPBarBreaked)
|
||||||
|
{
|
||||||
|
breakerBar = pBar;
|
||||||
|
}
|
||||||
|
bool isPPBarBreaked = IsBarBreak(
|
||||||
|
appliedPrice,
|
||||||
|
forDir,
|
||||||
|
ppBar //
|
||||||
|
);
|
||||||
|
if (isPPBarBreaked)
|
||||||
|
{
|
||||||
|
breakerBar = ppBar;
|
||||||
|
}
|
||||||
|
bool isBoxBreaked = isCBarBreaked ||
|
||||||
|
isPBarBreaked ||
|
||||||
|
isPPBarBreaked;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCBarRejected = IsBarReject(
|
||||||
|
appliedPrice,
|
||||||
|
forDir,
|
||||||
|
cBar //
|
||||||
|
);
|
||||||
|
if (isCBarRejected)
|
||||||
|
{
|
||||||
|
rejectBar = cBar;
|
||||||
|
}
|
||||||
|
bool isPBarRejected = IsBarReject(
|
||||||
|
appliedPrice,
|
||||||
|
forDir,
|
||||||
|
pBar //
|
||||||
|
);
|
||||||
|
if (isPBarRejected)
|
||||||
|
{
|
||||||
|
rejectBar = pBar;
|
||||||
|
}
|
||||||
|
bool isPPBarRejected = IsBarReject(
|
||||||
|
appliedPrice,
|
||||||
|
forDir,
|
||||||
|
ppBar //
|
||||||
|
);
|
||||||
|
if (isPPBarRejected)
|
||||||
|
{
|
||||||
|
rejectBar = ppBar;
|
||||||
|
}
|
||||||
|
bool isBoxRejected = isCBarRejected ||
|
||||||
|
isPBarRejected ||
|
||||||
|
isPPBarRejected;
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasRejectionBar = false;
|
||||||
|
if (isBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = state.CountBullishRejectionBars();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCRejectionBar *iZone = state.bullishRejectionBars[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isFilled = iZone.FillBar(iBar);
|
||||||
|
if (!isFilled)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iBarIndex = iBar.Index();
|
||||||
|
|
||||||
|
//
|
||||||
|
hasRejectionBar =
|
||||||
|
//
|
||||||
|
(iBarIndex == cBar.Index() ||
|
||||||
|
iBarIndex == pBar.Index())
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (hasRejectionBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!rejectBar.IsValid())
|
||||||
|
{
|
||||||
|
rejectBar = iBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = state.CountBearishRejectionBars();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCRejectionBar *iZone = state.bearishRejectionBars[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isFilled = iZone.FillBar(iBar);
|
||||||
|
if (!isFilled)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iBarIndex = iBar.Index();
|
||||||
|
|
||||||
|
//
|
||||||
|
hasRejectionBar =
|
||||||
|
//
|
||||||
|
(iBarIndex == cBar.Index() ||
|
||||||
|
iBarIndex == pBar.Index())
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (hasRejectionBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!rejectBar.IsValid())
|
||||||
|
{
|
||||||
|
rejectBar = iBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasMomentumBar = false;
|
||||||
|
if (isBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = state.CountBullishMomentumBars();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCMomentumBar *iZone = state.bullishMomentumBars[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isFilled = iZone.FillBar(iBar);
|
||||||
|
if (!isFilled)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iBarIndex = iBar.Index();
|
||||||
|
|
||||||
|
//
|
||||||
|
hasMomentumBar =
|
||||||
|
//
|
||||||
|
(iBarIndex == cBar.Index() ||
|
||||||
|
iBarIndex == pBar.Index())
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (hasMomentumBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!momentumBar.IsValid())
|
||||||
|
{
|
||||||
|
momentumBar = iBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = state.CountBearishMomentumBars();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCMomentumBar *iZone = state.bearishMomentumBars[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isFilled = iZone.FillBar(iBar);
|
||||||
|
if (!isFilled)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iBarIndex = iBar.Index();
|
||||||
|
|
||||||
|
//
|
||||||
|
hasMomentumBar =
|
||||||
|
//
|
||||||
|
(iBarIndex == cBar.Index() ||
|
||||||
|
iBarIndex == pBar.Index())
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (hasMomentumBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!momentumBar.IsValid())
|
||||||
|
{
|
||||||
|
momentumBar = iBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasSwing = false;
|
||||||
|
if (isBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = state.CountSwingLows();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSwing *iSwing = state.swingLows[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isFilled = iSwing.FillBar(iBar);
|
||||||
|
if (!isFilled)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iBarIndex = iBar.Index();
|
||||||
|
|
||||||
|
//
|
||||||
|
hasSwing =
|
||||||
|
//
|
||||||
|
(iBarIndex == cBar.Index() ||
|
||||||
|
iBarIndex == pBar.Index())
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (hasSwing)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!swingBar.IsValid())
|
||||||
|
{
|
||||||
|
swingBar = iBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = state.CountSwingHighs();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSwing *iSwing = state.swingHighs[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isFilled = iSwing.FillBar(iBar);
|
||||||
|
if (!isFilled)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iBarIndex = iBar.Index();
|
||||||
|
|
||||||
|
//
|
||||||
|
hasSwing =
|
||||||
|
//
|
||||||
|
(iBarIndex == cBar.Index() ||
|
||||||
|
iBarIndex == pBar.Index())
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (hasSwing)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!swingBar.IsValid())
|
||||||
|
{
|
||||||
|
swingBar = iBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasRequiredValidations =
|
||||||
|
//
|
||||||
|
(hasRejectionBar ||
|
||||||
|
hasMomentumBar)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(hasRejectionBar ||
|
||||||
|
hasSwing)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(hasMomentumBar ||
|
||||||
|
hasSwing)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
(isBoxBreaked &&
|
||||||
|
(hasRequiredValidations ||
|
||||||
|
hasValidSwing))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(isBoxRejected &&
|
||||||
|
(hasRequiredValidations ||
|
||||||
|
hasValidSwing))
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a Consolidation Zone ...
|
* Converts a Consolidation Zone ...
|
||||||
*
|
*
|
||||||
@@ -8044,13 +8568,14 @@ typedef void (*TOnPOIEvent)(ENUM_XPOI_EVENTS event,
|
|||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract UnActivated Order Blocks ...
|
* Extract UnActivated Order Blocks / Fair Value Gaps ...
|
||||||
*
|
*
|
||||||
* @return ( int )
|
* @return ( int )
|
||||||
*/
|
*/
|
||||||
int ExtractUnActivatedOrderBlocks(
|
template <typename T>
|
||||||
XCOrderBlock *&source[],
|
int ExtractUnActivatedZones(
|
||||||
XCOrderBlock *&dest[] //
|
T *&source[],
|
||||||
|
T *&dest[] //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -8071,7 +8596,7 @@ int ExtractUnActivatedOrderBlocks(
|
|||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCOrderBlock *iChild = source[i];
|
T *iChild = source[i];
|
||||||
ENUM_X_DIRECTION iChildForDir = iChild.GetDirection();
|
ENUM_X_DIRECTION iChildForDir = iChild.GetDirection();
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -8144,16 +8669,135 @@ int ExtractUnActivatedOrderBlocks(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract Directinal Based Order Blocks ...
|
* Extract ctivated Order Blocks / Fair Value Gaps ...
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
int ExtractActivatedZones(
|
||||||
|
T *&source[],
|
||||||
|
T *&dest[],
|
||||||
|
bool ignoreBreaktion = false //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(dest);
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(source);
|
||||||
|
int hasChild = IsValidSize(count);
|
||||||
|
if (!hasChild)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
T *iChild = source[i];
|
||||||
|
ENUM_X_DIRECTION iChildForDir = iChild.GetDirection();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Started Zones ...
|
||||||
|
XOHCL iChildStartedBar;
|
||||||
|
ENUM_X_DIRECTION iChildStartedDir;
|
||||||
|
bool isStarted = iChild.IsStarted(
|
||||||
|
iChildForDir,
|
||||||
|
iChildStartedBar,
|
||||||
|
iChildStartedDir //
|
||||||
|
);
|
||||||
|
if (!isStarted)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate InActive Zone ...
|
||||||
|
XOHCL iChildActivatedBar;
|
||||||
|
ENUM_X_DIRECTION iChildActivatedDir;
|
||||||
|
bool isActivated = iChild.IsActivated(
|
||||||
|
iChildForDir,
|
||||||
|
iChildActivatedBar,
|
||||||
|
iChildActivatedDir //
|
||||||
|
);
|
||||||
|
if (!isActivated)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Zone Iverse Breake ...
|
||||||
|
if (!ignoreBreaktion)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL iChildBreakedBar;
|
||||||
|
ENUM_X_DIRECTION iChildBreakedDir;
|
||||||
|
bool isBreaked = iChild.IsBreaked(
|
||||||
|
Opposit(iChildForDir),
|
||||||
|
iChildBreakedBar,
|
||||||
|
iChildBreakedDir,
|
||||||
|
true // Ignore Activation ...
|
||||||
|
);
|
||||||
|
if (isBreaked)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
isBreaked = iChild.IsBreaked(
|
||||||
|
iChildForDir,
|
||||||
|
iChildBreakedBar,
|
||||||
|
iChildBreakedDir,
|
||||||
|
true // Ignore Activation ...
|
||||||
|
);
|
||||||
|
if (isBreaked)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iChildIDX = -1;
|
||||||
|
bool isIChildExists = FindIndex(
|
||||||
|
iChildIDX,
|
||||||
|
iChild,
|
||||||
|
dest //
|
||||||
|
);
|
||||||
|
if (isIChildExists)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
iChild,
|
||||||
|
dest //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(dest);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract Directinal Based Order Blocks / Fair Value Gaps ...
|
||||||
*
|
*
|
||||||
* @param forDir: ENUM_X_DIRECTION member ...
|
* @param forDir: ENUM_X_DIRECTION member ...
|
||||||
*
|
*
|
||||||
* @return ( int )
|
* @return ( int )
|
||||||
*/
|
*/
|
||||||
int ExtractDirectionalOrderBlocks(
|
template <typename T>
|
||||||
|
int ExtractDirectionalZones(
|
||||||
ENUM_X_DIRECTION forDir,
|
ENUM_X_DIRECTION forDir,
|
||||||
XCOrderBlock *&source[],
|
T *&source[],
|
||||||
XCOrderBlock *&dest[] //
|
T *&dest[] //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -8174,15 +8818,15 @@ int ExtractDirectionalOrderBlocks(
|
|||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCOrderBlock *iOB = source[i];
|
T *iChild = source[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
ENUM_X_DIRECTION iForDir = iOB.GetDirection();
|
ENUM_X_DIRECTION iForDir = iChild.GetDirection();
|
||||||
if (forDir == iForDir)
|
if (forDir == iForDir)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Add(
|
Add(
|
||||||
iOB,
|
iChild,
|
||||||
dest //
|
dest //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -8196,15 +8840,16 @@ int ExtractDirectionalOrderBlocks(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort Order Blocks based on Place and Remove unused ...
|
* Sort Order Blocks / Fair Value Gaps based on Place and Remove unused ...
|
||||||
*/
|
*/
|
||||||
void OrderedSortOrderBlocks(
|
template <typename T>
|
||||||
XCOrderBlock *youngest,
|
void OrderedSortZones(
|
||||||
XCOrderBlock *&orderBlocks[] //
|
T *youngest,
|
||||||
|
T *&items[] //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
int count = ArraySize(orderBlocks);
|
int count = ArraySize(items);
|
||||||
if (youngest == NULL ||
|
if (youngest == NULL ||
|
||||||
!youngest.IsValid() ||
|
!youngest.IsValid() ||
|
||||||
!IsValidSize(count))
|
!IsValidSize(count))
|
||||||
@@ -8217,24 +8862,24 @@ void OrderedSortOrderBlocks(
|
|||||||
bool isBullish = IsBullish(dir);
|
bool isBullish = IsBullish(dir);
|
||||||
|
|
||||||
//
|
//
|
||||||
XCOrderBlock *tmp[];
|
T *tmp[];
|
||||||
XCOrderBlock *lastOB = youngest;
|
T *lastOB = youngest;
|
||||||
while (IsValidSize(count))
|
while (IsValidSize(count))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Detect Youngest of Collection ...
|
// Detect Youngest of Collection ...
|
||||||
int idx = GetYoungest(orderBlocks);
|
int idx = GetYoungest(items);
|
||||||
XCOrderBlock *iOB = orderBlocks[idx];
|
T *iChild = items[idx];
|
||||||
ArrayRemove(
|
ArrayRemove(
|
||||||
orderBlocks,
|
items,
|
||||||
idx,
|
idx,
|
||||||
1 //
|
1 //
|
||||||
);
|
);
|
||||||
count = ArraySize(orderBlocks);
|
count = ArraySize(items);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Direction Must be Same ...
|
// Check Direction Must be Same ...
|
||||||
ENUM_X_DIRECTION iDir = iOB.GetDirection();
|
ENUM_X_DIRECTION iDir = iChild.GetDirection();
|
||||||
bool isSameDir = dir == iDir;
|
bool isSameDir = dir == iDir;
|
||||||
if (!isSameDir)
|
if (!isSameDir)
|
||||||
{
|
{
|
||||||
@@ -8243,7 +8888,7 @@ void OrderedSortOrderBlocks(
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Check Creation time Sequence ...
|
// Check Creation time Sequence ...
|
||||||
bool isFromPassed = lastOB.From() > iOB.From();
|
bool isFromPassed = lastOB.From() > iChild.From();
|
||||||
if (!isFromPassed)
|
if (!isFromPassed)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -8254,7 +8899,7 @@ void OrderedSortOrderBlocks(
|
|||||||
bool isPlacePassed =
|
bool isPlacePassed =
|
||||||
isBullish
|
isBullish
|
||||||
? IsBelow(
|
? IsBelow(
|
||||||
iOB,
|
iChild,
|
||||||
lastOB,
|
lastOB,
|
||||||
true // Ignore Inside ...
|
true // Ignore Inside ...
|
||||||
)
|
)
|
||||||
@@ -8270,9 +8915,9 @@ void OrderedSortOrderBlocks(
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Update Last OB ...
|
// Update Last OB ...
|
||||||
lastOB = iOB;
|
lastOB = iChild;
|
||||||
Add(
|
Add(
|
||||||
iOB,
|
iChild,
|
||||||
tmp //
|
tmp //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -8291,6 +8936,135 @@ void OrderedSortOrderBlocks(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
template <typename T>
|
||||||
|
void OrderedSortZones(
|
||||||
|
T *&items[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = ArraySize(items);
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Youngest ...
|
||||||
|
int youngestIDX = GetYoungest(
|
||||||
|
items //
|
||||||
|
);
|
||||||
|
bool hasYoungest = IsValidSize(youngestIDX);
|
||||||
|
if (!hasYoungest)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
T *youngest = items[youngestIDX];
|
||||||
|
ArrayRemove(
|
||||||
|
items,
|
||||||
|
youngestIDX,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
count = ArraySize(items);
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
youngest,
|
||||||
|
items //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (youngest == NULL ||
|
||||||
|
!youngest.IsValid())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION dir = youngest.GetDirection();
|
||||||
|
bool isBullish = IsBullish(dir);
|
||||||
|
|
||||||
|
//
|
||||||
|
T *tmp[];
|
||||||
|
T *lastOB = youngest;
|
||||||
|
while (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detect Youngest of Collection ...
|
||||||
|
int idx = GetYoungest(items);
|
||||||
|
T *iChild = items[idx];
|
||||||
|
ArrayRemove(
|
||||||
|
items,
|
||||||
|
idx,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
count = ArraySize(items);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Direction Must be Same ...
|
||||||
|
ENUM_X_DIRECTION iDir = iChild.GetDirection();
|
||||||
|
bool isSameDir = dir == iDir;
|
||||||
|
if (!isSameDir)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Creation time Sequence ...
|
||||||
|
bool isFromPassed = lastOB.From() > iChild.From();
|
||||||
|
if (!isFromPassed)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Order Block Place ...
|
||||||
|
bool isPlacePassed =
|
||||||
|
isBullish
|
||||||
|
? IsBelow(
|
||||||
|
iChild,
|
||||||
|
lastOB,
|
||||||
|
true // Ignore Inside ...
|
||||||
|
)
|
||||||
|
: IsAbove(
|
||||||
|
iChild,
|
||||||
|
lastOB,
|
||||||
|
true // Ignore Inside ...
|
||||||
|
);
|
||||||
|
if (!isPlacePassed)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update Last OB ...
|
||||||
|
lastOB = iChild;
|
||||||
|
Add(
|
||||||
|
iChild,
|
||||||
|
tmp //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update Ordered Sorted Order Blocks ...
|
||||||
|
count = ArraySize(tmp);
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
tmp,
|
||||||
|
items //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract Order Flows Swing Points ...
|
* Extract Order Flows Swing Points ...
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user