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 (detectFVGBullishPivots)
{ {
// //
if (isBullishFVG) bool checkingCondition =
//
isBullishFVG &&
(cPeak > pPeak ||
pPeak > p2Peak)
//
;
//
if (checkingCondition)
{ {
// //
XBoxZone iBox; XBoxZone iBox;
@@ -2193,7 +2202,16 @@ class XCXCAEAPOIDetector : public XCBase
if (detectFVGBearishPivots) if (detectFVGBearishPivots)
{ {
// //
if (isBearishFVG) bool checkingCondition =
//
isBearishFVG &&
(cVale < pVale ||
pVale < p2Vale)
//
;
//
if (checkingCondition)
{ {
// //
XBoxZone iBox; XBoxZone iBox;
@@ -2921,7 +2939,8 @@ class XCXCAEAPOIDetector : public XCBase
// //
void Validate( void Validate(
XBoxZone &unAvailableBoxes[], XBoxZone &unAvailableBoxes[],
int barIndex = 0 // int barIndex = 0,
bool validateFVGsUsingPV = false //
) )
{ {
// //
@@ -2942,6 +2961,20 @@ class XCXCAEAPOIDetector : public XCBase
int pIDX = cIDX + 1; int pIDX = cIDX + 1;
int p2IDX = pIDX + 1; int p2IDX = pIDX + 1;
//
// Retrieve Conditions ...
XCAEAConditions conditions;
has = helper.GetConditions(
conditions,
barIndex,
5 //
);
if (!has)
{
conditions.Clean();
return;
}
// //
// Implement Validation Senarios ... // Implement Validation Senarios ...
@@ -3040,6 +3073,16 @@ class XCXCAEAPOIDetector : public XCBase
unAvailableBoxes, unAvailableBoxes,
barIndex // barIndex //
); );
//
if (validateFVGsUsingPV)
{
//
ApplyFVGPVValidation(
fvgBullishPivots,
conditions //
);
}
} }
// //
@@ -3055,6 +3098,16 @@ class XCXCAEAPOIDetector : public XCBase
unAvailableBoxes, unAvailableBoxes,
barIndex // barIndex //
); );
//
if (validateFVGsUsingPV)
{
//
ApplyFVGPVValidation(
fvgBearishPivots,
conditions //
);
}
} }
// //
@@ -3177,6 +3230,9 @@ class XCXCAEAPOIDetector : public XCBase
); );
} }
//
conditions.Clean();
// //
SortPivots(); SortPivots();
} }
@@ -4175,6 +4231,89 @@ class XCXCAEAPOIDetector : public XCBase
Clean(tmp); 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( void ApplySortOnBox(
XBoxZone &items[] // XBoxZone &items[] //
+156 -140
View File
@@ -318,6 +318,158 @@ class XCXCAEAPOIDrawer : public XCBase
DrawCCICrossedUnderOBPivots(to); 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( void DrawBoxes(
XBoxZone &boxes[], XBoxZone &boxes[],
@@ -340,146 +492,10 @@ class XCXCAEAPOIDrawer : public XCBase
// //
// Detect Pivot Type ... // Detect Pivot Type ...
ENUM_XCA_PIVOTS iType = GetPivotType(iBox); DrawBox(
has = IsValid(iType); iBox,
if (!has) to //
{ );
//
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;
}
// //
iBox.Clean(); iBox.Clean();
+242 -61
View File
@@ -428,6 +428,7 @@ bool DetectXCAEAConditions(
XCAEAConditions &conditions, XCAEAConditions &conditions,
XBoxZone &pivotBox, XBoxZone &pivotBox,
XBoxZone &box, XBoxZone &box,
double &targets[],
double &additionalSL, double &additionalSL,
ENUM_X_DIRECTION &dir, ENUM_X_DIRECTION &dir,
XCXCAEAHelper *helper, XCXCAEAHelper *helper,
@@ -681,6 +682,34 @@ bool DetectXCAEAConditions(
double pVale = conditions.valeBuffer[pIDX]; double pVale = conditions.valeBuffer[pIDX];
double p2Vale = conditions.valeBuffer[p2IDX]; 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 ... // X3MA ...
@@ -741,7 +770,7 @@ bool DetectXCAEAConditions(
// Create Conditions ... // Create Conditions ...
// //
bool isX3MABullishState = bool isX3MaBullishState =
z3MAFast > c3MAFast && z3MAFast > c3MAFast &&
isCBarValidForBullish && isCBarValidForBullish &&
c3MAFast > c3MAMedium && c3MAFast > c3MAMedium &&
@@ -751,7 +780,7 @@ bool DetectXCAEAConditions(
cBar.GetDown() > x3maBullishGapLower; cBar.GetDown() > x3maBullishGapLower;
// //
bool isX3MABearishState = bool isX3MaBearishState =
z3MAFast < c3MAFast && z3MAFast < c3MAFast &&
isCBarValidForBearish && isCBarValidForBearish &&
c3MAFast < c3MAMedium && c3MAFast < c3MAMedium &&
@@ -760,43 +789,76 @@ bool DetectXCAEAConditions(
cBar.high > x3maBearishGapLower && cBar.high > x3maBearishGapLower &&
cBar.GetUp() < 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 ... // Parsing Pivots ...
double providedSL = 0;
XBoxZone rejectedPivot;
XBoxZone insidePivots[];
int insidePivotsCount = 0;
bool hasInsidePivots = false;
bool hasPivots = HasChild(pivots); bool hasPivots = HasChild(pivots);
if (hasPivots) if (hasPivots)
{ {
// //
drawer.DrawBoxes( // drawer.DrawBoxes(
pivots, // pivots,
TimeCurrent() // // 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( has = SelectRejectedBox(
allowedPivots,
rejectedPivot, rejectedPivot,
pivots, pivots,
zBar, zBar,
@@ -806,25 +868,37 @@ bool DetectXCAEAConditions(
true, true,
true // true //
); );
// if (has)
// {
// //
// drawer.DrawBox(
// rejectedPivot,
// TimeCurrent() //
// );
// }
} }
// //
// Signaller Summarization ... // Signaller Summarization ...
// //
// Cond1 Act Using PEAK VALE Box Activation or Rejection ... // Cond1 Act Using FVG Rejections ...
// //
bool isCond1Bullish = bool isCond1Bullish =
// //
false rejectedPivot.IsValid() &&
rejectedPivot.IsBullish() // &&
// isX3MaValidForBullishRejection
// //
; ;
// //
bool isCond1Bearish = bool isCond1Bearish =
// //
false rejectedPivot.IsValid() &&
rejectedPivot.IsBearish() // &&
// isX3MaValidForBearishRejection
// //
; ;
@@ -834,18 +908,10 @@ bool DetectXCAEAConditions(
if (isCond1) if (isCond1)
{ {
// //
providedSL = drawer.DrawBox(
isCond1Bullish rejectedPivot,
? MathMin(pBar.low, pivotBox.lower) TimeCurrent() //
: MathMax(pBar.high, pivotBox.upper); );
//
additionalSL = 0.5 * conditions.atrBuffer[cIDX];
//
Print("Cond1");
isCond1Bullish = false;
isCond1Bearish = false;
} }
// //
@@ -870,14 +936,6 @@ bool DetectXCAEAConditions(
isCond2Bearish; isCond2Bearish;
if (isCond2) if (isCond2)
{ {
//
providedSL =
isCond2Bullish
? MathMin(pBar.low, pivotBox.lower)
: MathMax(pBar.high, pivotBox.upper);
//
Print("Cond2");
} }
// //
@@ -902,14 +960,6 @@ bool DetectXCAEAConditions(
isCond3Bearish; isCond3Bearish;
if (isCond3) if (isCond3)
{ {
//
providedSL =
isCond3Bullish
? MathMin(pBar.low, pivotBox.lower)
: MathMax(pBar.high, pivotBox.upper);
//
Print("Cond3");
} }
// //
@@ -950,6 +1000,123 @@ bool DetectXCAEAConditions(
dir // 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 = double sl =
providedSL > 0 providedSL > 0
@@ -1006,6 +1173,7 @@ bool DetectXCAEAConditions(
p2Bar.Clean(); p2Bar.Clean();
p3Bar.Clean(); p3Bar.Clean();
p4Bar.Clean(); p4Bar.Clean();
Clean(insidePivots);
pConditions.Clean(); pConditions.Clean();
rejectedPivot.Clean(); rejectedPivot.Clean();
@@ -1122,6 +1290,7 @@ int SelectInsideBoxes(
// //
bool SelectRejectedBox( bool SelectRejectedBox(
ENUM_XCA_PIVOTS &allowedTypes[],
XBoxZone &box, XBoxZone &box,
XBoxZone &boxes[], XBoxZone &boxes[],
XOHCL &zBar, XOHCL &zBar,
@@ -1157,6 +1326,18 @@ bool SelectRejectedBox(
// //
XBoxZone iBox = boxes[i]; 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 isBullish = iBox.IsBullish();
bool isBearish = iBox.IsBearish(); bool isBearish = iBox.IsBearish();
+25 -19
View File
@@ -169,6 +169,7 @@ class XCXCAEASignaller : XCBase
// //
// Setup Conditions ... // Setup Conditions ...
double targets[];
XBoxZone pivots[]; XBoxZone pivots[];
XBoxZone pivotBox; XBoxZone pivotBox;
XBoxZone signalBox; XBoxZone signalBox;
@@ -191,7 +192,8 @@ class XCXCAEASignaller : XCBase
// Validate Pivots ... // Validate Pivots ...
detector.Validate( detector.Validate(
unAvailableBoxes, unAvailableBoxes,
zIndex // zIndex,
true // Validate FVGs Using PV ...
); );
// //
@@ -265,6 +267,7 @@ class XCXCAEASignaller : XCBase
conditions, conditions,
pivotBox, pivotBox,
signalBox, signalBox,
targets,
additionalSL, additionalSL,
signalBoxDir, signalBoxDir,
helper, helper,
@@ -402,6 +405,13 @@ class XCXCAEASignaller : XCBase
mConditions.setupTime = zBar.time; mConditions.setupTime = zBar.time;
mConditions.conditions = conditions; mConditions.conditions = conditions;
//
// Targets Preparing ...
Copy(
targets,
mConditions.targets //
);
// //
// Select RF Rewards ... // Select RF Rewards ...
if (continuesRFTillTarget) if (continuesRFTillTarget)
@@ -860,16 +870,14 @@ class XCXCAEASignaller : XCBase
detector.detectRSIValePivots = false; detector.detectRSIValePivots = false;
detector.detectCCIPeakPivots = false; detector.detectCCIPeakPivots = false;
detector.detectCCIValePivots = false; detector.detectCCIValePivots = false;
detector.detectFVGBullishPivots = false; detector.detectFVGBullishPivots = true;
detector.detectFVGBearishPivots = false; detector.detectFVGBearishPivots = true;
detector.detectCCICrossedOverOSPivots = false; detector.detectValeSupSWLPivots = false;
detector.detectCCICrossedUnderOBPivots = false; detector.detectPeakResSWHPivots = false;
//
detector.detectValeSupSWLPivots = true;
detector.detectPeakResSWHPivots = true;
detector.detectTrendBullishPivots = true; detector.detectTrendBullishPivots = true;
detector.detectTrendBearishPivots = true; detector.detectTrendBearishPivots = true;
detector.detectCCICrossedOverOSPivots = false;
detector.detectCCICrossedUnderOBPivots = false;
detector.detectRSICrossedOverOSPivots = true; detector.detectRSICrossedOverOSPivots = true;
detector.detectRSICrossedUnderOBPivots = true; detector.detectRSICrossedUnderOBPivots = true;
@@ -890,19 +898,17 @@ class XCXCAEASignaller : XCBase
drawer.drawRSIValePivots = false; drawer.drawRSIValePivots = false;
drawer.drawCCIPeakPivots = false; drawer.drawCCIPeakPivots = false;
drawer.drawCCIValePivots = false; drawer.drawCCIValePivots = false;
drawer.drawFVGBullishPivots = false; drawer.drawFVGBullishPivots = true;
drawer.drawFVGBearishPivots = false; 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.drawCCICrossedOverOSPivots = false;
drawer.drawCCICrossedUnderOBPivots = false; drawer.drawCCICrossedUnderOBPivots = false;
//
drawer.drawValeSupSWLPivots = true;
drawer.drawPeakResSWHPivots = true;
drawer.drawTrendBullishPivots = true;
drawer.drawTrendBearishPivots = true;
drawer.drawRSICrossedOverOSPivots = true;
drawer.drawRSICrossedUnderOBPivots = true;
// //
// Configure Widths ... // Configure Widths ...
drawer.tickPivotsWidth = 2; drawer.tickPivotsWidth = 2;