This commit is contained in:
2025-05-13 02:06:42 +03:30
parent c927f50934
commit 4a39f09fae
3 changed files with 236 additions and 66 deletions
+182 -16
View File
@@ -538,6 +538,7 @@ bool DetectDecisionZone(
XCXCAEAPOIDrawer *drawer,
XBoxZone &box,
ENUM_X_DIRECTION &dir,
XBoxZone &unavailables[],
XCAEAConditions &conditions,
int barIndex = 0,
int loopback = 10 //
@@ -1210,7 +1211,20 @@ bool DetectDecisionZone(
if (result)
{
//
// Do Signal Preparing ...
// Check UnAvailables ...
int idx = -1;
has = FindBoxIndex(
idx,
box,
unavailables //
);
if (has)
{
//
box.Clean();
conditions.Clean();
dir = X_DIRECTION_NONE;
}
//
// Check Box is Prepared or Not ...
@@ -1235,6 +1249,7 @@ bool DetectDecisionZone(
//
box.Clean();
conditions.Clean();
dir = X_DIRECTION_NONE;
}
//
@@ -1660,46 +1675,195 @@ bool CanTriggerCond2(
return result;
}
//
string symbol = helper.GetSymbol();
bool isBullish = decisionZone.IsBullish();
bool isBearish = decisionZone.IsBearish();
ENUM_TIMEFRAMES period = helper.GetPeriod();
//
int zIndex = barIndex;
int cIndex = zIndex + 1;
int pIndex = cIndex + 1;
int p2Index = pIndex + 1;
//
// Extract Bars ...
XOHCL zBar;
XOHCL cBar;
result = zBar.Init(
symbol,
period,
cIndex //
);
result =
result &&
zBar.GetPreviousBar(cBar);
if (!result)
{
//
zBar.Clean();
cBar.Clean();
//
return result;
}
//
bool has = false;
XBoxZone selectedPivot;
bool hasPivots = HasChild(decisionPivots);
int pivotsCount = ArraySize(decisionPivots);
//
// Draw Decision Pivots ...
// Select Activated Pivot ...
if (hasPivots)
{
//
for (int i = 0; i < pivotsCount; i++)
{
//
XCBoxObject *iObj;
//
has = helper.poiDrawer.DrawBox(
decisionPivots[i],
iObj //
);
// Check Rejection of Block ...
has =
isBullish
? cBar.IsBullish() &&
decisionPivots[i].IsBullish() &&
cBar.low < decisionPivots[i].upper &&
cBar.low > decisionPivots[i].lower &&
cBar.close > decisionPivots[i].upper
: cBar.IsBearish() &&
decisionPivots[i].IsBearish() &&
cBar.high > decisionPivots[i].lower &&
cBar.high < decisionPivots[i].upper &&
cBar.close < decisionPivots[i].lower;
if (has)
{
drawns.Add(iObj);
selectedPivot = decisionPivots[i];
}
//
ZeroMemory(iObj);
// //
// // Draw Pivot ...
// XCBoxObject *iObj;
// //
// has = helper.poiDrawer.DrawBox(
// decisionPivots[i],
// iObj //
// );
// if (has)
// {
// drawns.Add(iObj);
// }
// //
// ZeroMemory(iObj);
}
}
//
// Check Selected Pivot is Exists or not ...
bool hasSelectedPivot = selectedPivot.IsValid();
//
// Detect Liquidity For Selected Pivot ...
double ssl = 0;
double bsl = 0;
bool hasSSL = false;
bool hasBSL = false;
if (hasSelectedPivot)
{
//
// Required Info ...
// int toIDX = selectedPivot.ToIndex();
// int fromIDX = selectedPivot.FromIndex();
// //
// // SSL ...
// datetime sslTo = NULL;
// datetime sslFrom = NULL;
// //
// // BSL ...
// datetime bslTo = NULL;
// datetime bslFrom = NULL;
// //
// // Loop ...
// XOHCL iBar;
// for (int i = fromIDX; i > toIDX; i--)
// {
// //
// hasSSL =
// ssl > 0 &&
// IsValid(sslTo) &&
// IsValid(sslFrom);
// //
// hasBSL =
// bsl > 0 &&
// IsValid(bslTo) &&
// IsValid(bslFrom);
// //
// iBar.Clean();
// //
// if (hasSSL && hasBSL)
// {
// break;
// }
// }
// iBar.Clean();
}
//
// Draw Selected Pivot ...
if (hasSelectedPivot)
{
//
// Draw Pivot ...
XCBoxObject *iObj;
//
has = helper.poiDrawer.DrawBox(
selectedPivot,
iObj //
);
if (has)
{
//
color iColor =
isBullish
? clrAqua
: clrMagenta;
//
iObj.BoxWidth(2);
iObj.BoxColor(iColor);
iObj.BoxStyle(STYLE_SOLID);
//
drawns.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
// Summarizing ...
//
bool canTriggerLong =
false;
isBullish &&
hasSelectedPivot &&
selectedPivot.IsBullish();
//
bool canTriggerShort =
false;
isBearish &&
hasSelectedPivot &&
selectedPivot.IsBearish();
//
result = canTriggerLong ||
@@ -1715,8 +1879,8 @@ bool CanTriggerCond2(
//
sl = canTriggerLong
? decisionZone.lower // activatedFVG.lower
: decisionZone.upper; // activatedFVG.upper;
? selectedPivot.lower // activatedFVG.lower
: selectedPivot.upper; // activatedFVG.upper;
//
// Since Here TP Must Calculated
@@ -1726,6 +1890,8 @@ bool CanTriggerCond2(
//
// Cleanup Resources ...
zBar.Clean();
cBar.Clean();
//
return result;