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
+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();