This commit is contained in:
2025-04-27 19:13:26 +03:30
parent 97a444c92d
commit fdfcfda5c5
4 changed files with 565 additions and 223 deletions
+142 -3
View File
@@ -2151,7 +2151,16 @@ class XCXCAEAPOIDetector : public XCBase
if (detectFVGBullishPivots)
{
//
if (isBullishFVG)
bool checkingCondition =
//
isBullishFVG &&
(cPeak > pPeak ||
pPeak > p2Peak)
//
;
//
if (checkingCondition)
{
//
XBoxZone iBox;
@@ -2193,7 +2202,16 @@ class XCXCAEAPOIDetector : public XCBase
if (detectFVGBearishPivots)
{
//
if (isBearishFVG)
bool checkingCondition =
//
isBearishFVG &&
(cVale < pVale ||
pVale < p2Vale)
//
;
//
if (checkingCondition)
{
//
XBoxZone iBox;
@@ -2921,7 +2939,8 @@ class XCXCAEAPOIDetector : public XCBase
//
void Validate(
XBoxZone &unAvailableBoxes[],
int barIndex = 0 //
int barIndex = 0,
bool validateFVGsUsingPV = false //
)
{
//
@@ -2942,6 +2961,20 @@ class XCXCAEAPOIDetector : public XCBase
int pIDX = cIDX + 1;
int p2IDX = pIDX + 1;
//
// Retrieve Conditions ...
XCAEAConditions conditions;
has = helper.GetConditions(
conditions,
barIndex,
5 //
);
if (!has)
{
conditions.Clean();
return;
}
//
// Implement Validation Senarios ...
@@ -3040,6 +3073,16 @@ class XCXCAEAPOIDetector : public XCBase
unAvailableBoxes,
barIndex //
);
//
if (validateFVGsUsingPV)
{
//
ApplyFVGPVValidation(
fvgBullishPivots,
conditions //
);
}
}
//
@@ -3055,6 +3098,16 @@ class XCXCAEAPOIDetector : public XCBase
unAvailableBoxes,
barIndex //
);
//
if (validateFVGsUsingPV)
{
//
ApplyFVGPVValidation(
fvgBearishPivots,
conditions //
);
}
}
//
@@ -3177,6 +3230,9 @@ class XCXCAEAPOIDetector : public XCBase
);
}
//
conditions.Clean();
//
SortPivots();
}
@@ -4175,6 +4231,89 @@ class XCXCAEAPOIDetector : public XCBase
Clean(tmp);
}
//
void ApplyFVGPVValidation(
XBoxZone &fvgs[],
XCAEAConditions &conditions //
)
{
//
int zIDX = 0;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
int p2IDX = pIDX + 1;
//
bool has = HasChild(fvgs);
if (!has)
{
return;
}
//
// Reading Values ...
//
// PEAK ...
double zPeak = conditions.peakBuffer[zIDX];
double cPeak = conditions.peakBuffer[cIDX];
double pPeak = conditions.peakBuffer[pIDX];
double p2Peak = conditions.peakBuffer[p2IDX];
//
// VALE ...
double zVale = conditions.valeBuffer[zIDX];
double cVale = conditions.valeBuffer[cIDX];
double pVale = conditions.valeBuffer[pIDX];
double p2Vale = conditions.valeBuffer[p2IDX];
//
XBoxZone tmp[];
Copy(
fvgs,
tmp //
);
Clean(fvgs);
while (HasChild(tmp))
{
//
XBoxZone iBox = tmp[0];
ArrayRemove(
tmp,
0,
1 //
);
//
bool isBullish = iBox.IsBullish();
//
bool isTooOld = iBox.GetAge() > 21;
bool isPVBreaked =
isBullish
? cVale > iBox.upper
: cPeak < iBox.lower;
//
has = !isTooOld &&
!isPVBreaked;
if (has)
{
//
AddRef(
iBox,
fvgs //
);
}
//
iBox.Clean();
}
//
Clean(tmp);
}
//
void ApplySortOnBox(
XBoxZone &items[] //
+156 -140
View File
@@ -318,6 +318,158 @@ class XCXCAEAPOIDrawer : public XCBase
DrawCCICrossedUnderOBPivots(to);
}
//
void DrawBox(
XBoxZone &box,
datetime to = NULL //
)
{
//
bool has = box.IsValid();
if (!has)
{
return;
}
//
// Detect Pivot Type ...
ENUM_XCA_PIVOTS iType = GetPivotType(box);
has = IsValid(iType);
if (!has)
{
return;
}
//
switch (iType)
{
//
case XCA_TICK:
//
DrawTickPivot(
box,
to //
);
break;
//
case XCA_VOLUME:
//
DrawVolumePivot(
box,
to //
);
break;
//
case XCA_FVG_BULL:
//
DrawFVGBullishPivot(
box,
to //
);
break;
//
case XCA_FVG_BEAR:
//
DrawFVGBearishPivot(
box,
to //
);
break;
//
case XCA_RSI_COOS:
//
DrawRSICrossedOverOSPivot(
box,
to //
);
break;
//
case XCA_RSI_CUOB:
//
DrawRSICrossedUnderOBPivot(
box,
to //
);
break;
//
case XCA_RSI_PEAK:
//
DrawRSIPeakPivot(
box,
to //
);
break;
//
case XCA_RSI_VALE:
//
DrawRSIValePivot(
box,
to //
);
break;
//
case XCA_CCI_COOS:
//
DrawCCICrossedOverOSPivot(
box,
to //
);
break;
//
case XCA_CCI_CUOB:
//
DrawCCICrossedUnderOBPivot(
box,
to //
);
break;
//
case XCA_CCI_PEAK:
//
DrawCCIPeakPivot(
box,
to //
);
break;
//
case XCA_CCI_VALE:
//
DrawCCIValePivot(
box,
to //
);
break;
//
case XCA_PEAKSWHRES:
//
DrawPeakResSWHPivot(
box,
to //
);
break;
//
case XCA_VALESWLSUP:
//
DrawValeSupSWLPivot(
box,
to //
);
break;
}
}
//
void DrawBoxes(
XBoxZone &boxes[],
@@ -340,146 +492,10 @@ class XCXCAEAPOIDrawer : public XCBase
//
// Detect Pivot Type ...
ENUM_XCA_PIVOTS iType = GetPivotType(iBox);
has = IsValid(iType);
if (!has)
{
//
iBox.Clean();
//
continue;
}
//
switch (iType)
{
//
case XCA_TICK:
//
DrawTickPivot(
iBox,
to //
);
break;
//
case XCA_VOLUME:
//
DrawVolumePivot(
iBox,
to //
);
break;
//
case XCA_FVG_BULL:
//
DrawFVGBullishPivot(
iBox,
to //
);
break;
//
case XCA_FVG_BEAR:
//
DrawFVGBearishPivot(
iBox,
to //
);
break;
//
case XCA_RSI_COOS:
//
DrawRSICrossedOverOSPivot(
iBox,
to //
);
break;
//
case XCA_RSI_CUOB:
//
DrawRSICrossedUnderOBPivot(
iBox,
to //
);
break;
//
case XCA_RSI_PEAK:
//
DrawRSIPeakPivot(
iBox,
to //
);
break;
//
case XCA_RSI_VALE:
//
DrawRSIValePivot(
iBox,
to //
);
break;
//
case XCA_CCI_COOS:
//
DrawCCICrossedOverOSPivot(
iBox,
to //
);
break;
//
case XCA_CCI_CUOB:
//
DrawCCICrossedUnderOBPivot(
iBox,
to //
);
break;
//
case XCA_CCI_PEAK:
//
DrawCCIPeakPivot(
iBox,
to //
);
break;
//
case XCA_CCI_VALE:
//
DrawCCIValePivot(
iBox,
to //
);
break;
//
case XCA_PEAKSWHRES:
//
DrawPeakResSWHPivot(
iBox,
to //
);
break;
//
case XCA_VALESWLSUP:
//
DrawValeSupSWLPivot(
iBox,
to //
);
break;
}
DrawBox(
iBox,
to //
);
//
iBox.Clean();
+242 -61
View File
@@ -428,6 +428,7 @@ bool DetectXCAEAConditions(
XCAEAConditions &conditions,
XBoxZone &pivotBox,
XBoxZone &box,
double &targets[],
double &additionalSL,
ENUM_X_DIRECTION &dir,
XCXCAEAHelper *helper,
@@ -681,6 +682,34 @@ bool DetectXCAEAConditions(
double pVale = conditions.valeBuffer[pIDX];
double p2Vale = conditions.valeBuffer[p2IDX];
//
// SUPPORT ...
double zSupport = conditions.supportBuffer[zIDX];
double cSupport = conditions.supportBuffer[cIDX];
double pSupport = conditions.supportBuffer[pIDX];
double p2Support = conditions.supportBuffer[p2IDX];
//
// RESISTANCE ...
double zResistance = conditions.resistanceBuffer[zIDX];
double cResistance = conditions.resistanceBuffer[cIDX];
double pResistance = conditions.resistanceBuffer[pIDX];
double p2Resistance = conditions.resistanceBuffer[p2IDX];
//
// SWING LOW ...
double zSwingLow = conditions.swingLowBuffer[zIDX];
double cSwingLow = conditions.swingLowBuffer[cIDX];
double pSwingLow = conditions.swingLowBuffer[pIDX];
double p2SwingLow = conditions.swingLowBuffer[p2IDX];
//
// SWING HIGH ...
double zSwingHigh = conditions.swingHighBuffer[zIDX];
double cSwingHigh = conditions.swingHighBuffer[cIDX];
double pSwingHigh = conditions.swingHighBuffer[pIDX];
double p2SwingHigh = conditions.swingHighBuffer[p2IDX];
//
// X3MA ...
@@ -741,7 +770,7 @@ bool DetectXCAEAConditions(
// Create Conditions ...
//
bool isX3MABullishState =
bool isX3MaBullishState =
z3MAFast > c3MAFast &&
isCBarValidForBullish &&
c3MAFast > c3MAMedium &&
@@ -751,7 +780,7 @@ bool DetectXCAEAConditions(
cBar.GetDown() > x3maBullishGapLower;
//
bool isX3MABearishState =
bool isX3MaBearishState =
z3MAFast < c3MAFast &&
isCBarValidForBearish &&
c3MAFast < c3MAMedium &&
@@ -760,43 +789,76 @@ bool DetectXCAEAConditions(
cBar.high > x3maBearishGapLower &&
cBar.GetUp() < x3maBearishGapLower;
//
bool isX3MaValidForBullishRejection =
//
c3MASlowState > 0 &&
z3MASlowState > 0 &&
z3MAMediumState > 0 &&
c3MAMediumState > 0 &&
z3MAMedium > z3MASlow &&
c3MAMedium > c3MASlow
//
;
//
bool isX3MaValidForBearishRejection =
//
c3MASlowState < 0 &&
z3MASlowState < 0 &&
z3MAMediumState < 0 &&
c3MAMediumState < 0 &&
z3MAMedium < z3MASlow &&
c3MAMedium < c3MASlow
//
;
//
// Parsing Pivots ...
double providedSL = 0;
XBoxZone rejectedPivot;
XBoxZone insidePivots[];
int insidePivotsCount = 0;
bool hasInsidePivots = false;
bool hasPivots = HasChild(pivots);
if (hasPivots)
{
//
drawer.DrawBoxes(
pivots,
TimeCurrent() //
);
}
// drawer.DrawBoxes(
// pivots,
// TimeCurrent() //
// );
//
// Select Inside Boxes ...
XBoxZone insidePivots[];
int insidePivotsCount = SelectInsideBoxes(
insidePivots,
pivots,
zBar,
cBar,
pBar,
p2Bar //
);
bool hasInsidePivots = IsValidSize(insidePivotsCount);
if (hasInsidePivots)
{
// drawer.DrawBoxes(insidePivots, TimeCurrent());
}
//
// Detect Selected Pivot ...
XBoxZone rejectedPivot;
double providedSL = 0;
if (hasPivots)
{
//
// Select Inside Boxes ...
insidePivotsCount = SelectInsideBoxes(
insidePivots,
pivots,
zBar,
cBar,
pBar,
p2Bar //
);
//
hasInsidePivots = IsValidSize(insidePivotsCount);
if (hasInsidePivots)
{
// drawer.DrawBoxes(insidePivots, TimeCurrent());
}
//
// Detect Rejected Pivot ...
ENUM_XCA_PIVOTS allowedPivots[] = {
XCA_FVG_BULL,
XCA_FVG_BEAR,
// XCA_PEAKSWHRES,
// XCA_VALESWLSUP,
// XCA_TREND_BULL,
// XCA_TREND_BEAR,
};
has = SelectRejectedBox(
allowedPivots,
rejectedPivot,
pivots,
zBar,
@@ -806,25 +868,37 @@ bool DetectXCAEAConditions(
true,
true //
);
// if (has)
// {
// //
// drawer.DrawBox(
// rejectedPivot,
// TimeCurrent() //
// );
// }
}
//
// Signaller Summarization ...
//
// Cond1 Act Using PEAK VALE Box Activation or Rejection ...
// Cond1 Act Using FVG Rejections ...
//
bool isCond1Bullish =
//
false
rejectedPivot.IsValid() &&
rejectedPivot.IsBullish() // &&
// isX3MaValidForBullishRejection
//
;
//
bool isCond1Bearish =
//
false
rejectedPivot.IsValid() &&
rejectedPivot.IsBearish() // &&
// isX3MaValidForBearishRejection
//
;
@@ -834,18 +908,10 @@ bool DetectXCAEAConditions(
if (isCond1)
{
//
providedSL =
isCond1Bullish
? MathMin(pBar.low, pivotBox.lower)
: MathMax(pBar.high, pivotBox.upper);
//
additionalSL = 0.5 * conditions.atrBuffer[cIDX];
//
Print("Cond1");
isCond1Bullish = false;
isCond1Bearish = false;
drawer.DrawBox(
rejectedPivot,
TimeCurrent() //
);
}
//
@@ -870,14 +936,6 @@ bool DetectXCAEAConditions(
isCond2Bearish;
if (isCond2)
{
//
providedSL =
isCond2Bullish
? MathMin(pBar.low, pivotBox.lower)
: MathMax(pBar.high, pivotBox.upper);
//
Print("Cond2");
}
//
@@ -902,14 +960,6 @@ bool DetectXCAEAConditions(
isCond3Bearish;
if (isCond3)
{
//
providedSL =
isCond3Bullish
? MathMin(pBar.low, pivotBox.lower)
: MathMax(pBar.high, pivotBox.upper);
//
Print("Cond3");
}
//
@@ -950,6 +1000,123 @@ bool DetectXCAEAConditions(
dir //
);
//
if (isCond1)
{
//
double sls[];
if (isCond1Bullish)
{
//
// Rejected Pivot ...
Add(
rejectedPivot.lower,
sls //
);
//
// X3MA Medium ...
if (c3MAMedium < entry)
{
//
Add(
c3MAMedium,
sls //
);
}
}
else
{
//
// Rejected Pivot ...
Add(
rejectedPivot.upper,
sls //
);
//
// X3MA Medium ...
if (c3MAMedium > entry)
{
//
Add(
c3MAMedium,
sls //
);
}
}
//
providedSL =
isCond1Bullish
? GetMax(sls)
: GetMin(sls);
//
double supportRisk = MathAbs(entry - cSupport);
double supportRiskPoint = supportRisk / points;
//
double resistanceRisk = MathAbs(entry - cSupport);
double resistanceRiskPoint = resistanceRisk / points;
//
double rejectedPivotMid = rejectedPivot.lower +
((rejectedPivot.upper - rejectedPivot.lower) / 2);
double rejectedPivotMidRisk = MathAbs(entry - rejectedPivotMid);
double rejectedPivotMidRiskInPoint = rejectedPivotMid / points;
//
Clean(sls);
//
// Preparing Targets ...
if (isBullish)
{
//
if (cPeak > entry)
{
//
Add(
cPeak,
targets //
);
}
}
else
{
//
if (cVale < entry)
{
//
Add(
cVale,
targets //
);
}
}
}
//
double risk = MathAbs(providedSL - entry);
double riskPoint = risk / points;
//
double minAllowedSLRiskPoint = 25.0;
double minAllowedSLRisk = minAllowedSLRiskPoint * points;
double minAllowedSL =
isBullish
? entry - minAllowedSLRisk
: entry + minAllowedSLRisk;
//
double maxAllowedSLRiskPoint = 40.0;
double maxAllowedSLRisk = maxAllowedSLRiskPoint * points;
double maxAllowedSL =
isBullish
? entry + maxAllowedSLRisk
: entry - maxAllowedSLRisk;
//
double sl =
providedSL > 0
@@ -1006,6 +1173,7 @@ bool DetectXCAEAConditions(
p2Bar.Clean();
p3Bar.Clean();
p4Bar.Clean();
Clean(insidePivots);
pConditions.Clean();
rejectedPivot.Clean();
@@ -1122,6 +1290,7 @@ int SelectInsideBoxes(
//
bool SelectRejectedBox(
ENUM_XCA_PIVOTS &allowedTypes[],
XBoxZone &box,
XBoxZone &boxes[],
XOHCL &zBar,
@@ -1157,6 +1326,18 @@ bool SelectRejectedBox(
//
XBoxZone iBox = boxes[i];
//
ENUM_XCA_PIVOTS iType = GetPivotType(iBox);
bool isAllowedType = IsValid(iType) &&
Contains(
iType,
allowedTypes //
);
if (!isAllowedType)
{
continue;
}
//
bool isBullish = iBox.IsBullish();
bool isBearish = iBox.IsBearish();
+25 -19
View File
@@ -169,6 +169,7 @@ class XCXCAEASignaller : XCBase
//
// Setup Conditions ...
double targets[];
XBoxZone pivots[];
XBoxZone pivotBox;
XBoxZone signalBox;
@@ -191,7 +192,8 @@ class XCXCAEASignaller : XCBase
// Validate Pivots ...
detector.Validate(
unAvailableBoxes,
zIndex //
zIndex,
true // Validate FVGs Using PV ...
);
//
@@ -265,6 +267,7 @@ class XCXCAEASignaller : XCBase
conditions,
pivotBox,
signalBox,
targets,
additionalSL,
signalBoxDir,
helper,
@@ -402,6 +405,13 @@ class XCXCAEASignaller : XCBase
mConditions.setupTime = zBar.time;
mConditions.conditions = conditions;
//
// Targets Preparing ...
Copy(
targets,
mConditions.targets //
);
//
// Select RF Rewards ...
if (continuesRFTillTarget)
@@ -860,16 +870,14 @@ class XCXCAEASignaller : XCBase
detector.detectRSIValePivots = false;
detector.detectCCIPeakPivots = false;
detector.detectCCIValePivots = false;
detector.detectFVGBullishPivots = false;
detector.detectFVGBearishPivots = false;
detector.detectCCICrossedOverOSPivots = false;
detector.detectCCICrossedUnderOBPivots = false;
//
detector.detectValeSupSWLPivots = true;
detector.detectPeakResSWHPivots = true;
detector.detectFVGBullishPivots = true;
detector.detectFVGBearishPivots = true;
detector.detectValeSupSWLPivots = false;
detector.detectPeakResSWHPivots = false;
detector.detectTrendBullishPivots = true;
detector.detectTrendBearishPivots = true;
detector.detectCCICrossedOverOSPivots = false;
detector.detectCCICrossedUnderOBPivots = false;
detector.detectRSICrossedOverOSPivots = true;
detector.detectRSICrossedUnderOBPivots = true;
@@ -890,19 +898,17 @@ class XCXCAEASignaller : XCBase
drawer.drawRSIValePivots = false;
drawer.drawCCIPeakPivots = false;
drawer.drawCCIValePivots = false;
drawer.drawFVGBullishPivots = false;
drawer.drawFVGBearishPivots = false;
drawer.drawFVGBullishPivots = true;
drawer.drawFVGBearishPivots = true;
drawer.drawValeSupSWLPivots = false;
drawer.drawPeakResSWHPivots = false;
drawer.drawTrendBullishPivots = false;
drawer.drawTrendBearishPivots = false;
drawer.drawRSICrossedOverOSPivots = false;
drawer.drawRSICrossedUnderOBPivots = false;
drawer.drawCCICrossedOverOSPivots = false;
drawer.drawCCICrossedUnderOBPivots = false;
//
drawer.drawValeSupSWLPivots = true;
drawer.drawPeakResSWHPivots = true;
drawer.drawTrendBullishPivots = true;
drawer.drawTrendBearishPivots = true;
drawer.drawRSICrossedOverOSPivots = true;
drawer.drawRSICrossedUnderOBPivots = true;
//
// Configure Widths ...
drawer.tickPivotsWidth = 2;