apply correction on fvg cond signalling ...

This commit is contained in:
2025-04-29 01:15:56 +03:30
parent 806fdeb4bb
commit ab6a32c264
3 changed files with 209 additions and 44 deletions
+101 -34
View File
@@ -665,9 +665,40 @@ bool DetectXCAEAConditions(
conditions
.GenerateSummary();
//
// Calculating Range Volumes ...
//
double bullishVolume = 0;
double bearishVolume = 0;
int volumeRangeLoopback = 5;
helper.barAnalyser.CalculateRangeVolume(
cBar,
bullishVolume,
bearishVolume,
volumeRangeLoopback //
);
//
double rangeVolume = bullishVolume = bearishVolume;
double rangeVolumeAvg = rangeVolume / volumeRangeLoopback;
//
bool isVolumeBullish = bullishVolume > bearishVolume;
bool isVolumeBearish = bullishVolume < bearishVolume;
bool isVolumeOverLast = cBar.volume > pBar.volume;
bool isVolumeOverAvg = cBar.volume > rangeVolumeAvg;
//
// Conditions ...
//
// SAR ...
double zSar = conditions.sarBuffer[zIDX];
double cSar = conditions.sarBuffer[cIDX];
double pSar = conditions.sarBuffer[pIDX];
double p2Sar = conditions.sarBuffer[p2IDX];
//
// PEAK ...
double zPeak = conditions.peakBuffer[zIDX];
@@ -797,7 +828,8 @@ bool DetectXCAEAConditions(
z3MAMediumState > 0 &&
c3MAMediumState > 0 &&
z3MAMedium > z3MASlow &&
c3MAMedium > c3MASlow
c3MAMedium > c3MASlow &&
conditions.isVidyaBullish
//
;
@@ -809,7 +841,8 @@ bool DetectXCAEAConditions(
z3MAMediumState < 0 &&
c3MAMediumState < 0 &&
z3MAMedium < z3MASlow &&
c3MAMedium < c3MASlow
c3MAMedium < c3MASlow &&
conditions.isVidyaBearish
//
;
@@ -832,7 +865,18 @@ bool DetectXCAEAConditions(
//
// Select Inside Boxes ...
//
ENUM_XCA_PIVOTS allowedInsidePivots[] = {
XCA_FVG_BULL,
XCA_FVG_BEAR,
XCA_PEAKSWHRES,
XCA_VALESWLSUP,
XCA_TREND_BULL,
XCA_TREND_BEAR,
};
insidePivotsCount = SelectInsideBoxes(
allowedInsidePivots,
insidePivots,
pivots,
zBar,
@@ -840,17 +884,19 @@ bool DetectXCAEAConditions(
pBar,
p2Bar //
);
//
hasInsidePivots = IsValidSize(insidePivotsCount);
if (hasInsidePivots)
{
// drawer.DrawBoxes(insidePivots, TimeCurrent());
//
// drawer.DrawBoxes(
// insidePivots,
// zBar.time //
// );
}
//
// Detect Rejected Pivot ...
ENUM_XCA_PIVOTS allowedPivots[] = {
ENUM_XCA_PIVOTS allowedRejectedPivots[] = {
XCA_FVG_BULL,
XCA_FVG_BEAR,
// XCA_PEAKSWHRES,
@@ -859,7 +905,7 @@ bool DetectXCAEAConditions(
// XCA_TREND_BEAR,
};
has = SelectRejectedBox(
allowedPivots,
allowedRejectedPivots,
rejectedPivot,
isRejectedOnMid,
pivots,
@@ -871,14 +917,6 @@ bool DetectXCAEAConditions(
true,
true //
);
// if (has)
// {
// //
// drawer.DrawBox(
// rejectedPivot,
// TimeCurrent() //
// );
// }
}
//
@@ -890,6 +928,10 @@ bool DetectXCAEAConditions(
//
bool isCond1Bullish =
//
// false && // TODO: Remove this ...
isVolumeOverAvg &&
isVolumeOverLast &&
conditions.isSarBullish &&
rejectedPivot.IsValid() &&
rejectedPivot.IsBullish() &&
isX3MaValidForBullishRejection
@@ -899,6 +941,10 @@ bool DetectXCAEAConditions(
//
bool isCond1Bearish =
//
// false && // TODO: Remove this ...
isVolumeOverAvg &&
isVolumeOverLast &&
conditions.isSarBearish &&
rejectedPivot.IsValid() &&
rejectedPivot.IsBearish() &&
isX3MaValidForBearishRejection
@@ -918,6 +964,9 @@ bool DetectXCAEAConditions(
rejectedPivot,
TimeCurrent() //
);
//
Print("Cond1");
}
//
@@ -926,9 +975,19 @@ bool DetectXCAEAConditions(
//
bool isCond2Bullish =
//
false &&
isX3MaBearishState &&
isCBarBullishRejected // &&
// false &&
//
c3MASlowState > 0 &&
c3MAMediumState > 0 &&
cBar.GetUp() > pSar &&
conditions.isFastOverSlow &&
conditions.isVidyaBullish &&
conditions.isFastOverMedium &&
conditions.isSarSwitchedToBullish
//
//
// isX3MaBearishState &&
// isCBarBullishRejected // &&
// cBar.GetDown() > pVale &&
// conditions.isValeUnderLast
//
@@ -937,9 +996,9 @@ bool DetectXCAEAConditions(
//
bool isCond2Bearish =
//
false &&
isX3MaBullishState &&
isCBarBearishRejected // &&
false // &&
// isX3MaBullishState &&
// isCBarBearishRejected // &&
// cBar.GetUp() < pPeak &&
// conditions.isPeakOverLast
//
@@ -951,7 +1010,7 @@ bool DetectXCAEAConditions(
if (isCond2)
{
//
// Print("Cond2");
Print("Cond2");
}
//
@@ -1166,6 +1225,7 @@ bool DetectXCAEAConditions(
//
// Select Inside Boxes ...
int SelectInsideBoxes(
ENUM_XCA_PIVOTS &allowedTypes[],
XBoxZone &insideBoxes[],
XBoxZone &boxes[],
XOHCL &zBar,
@@ -1200,14 +1260,15 @@ int SelectInsideBoxes(
XBoxZone iBox = boxes[i];
//
// Check Box Type ...
bool isTypePassed =
//
iBox.type == GetBoxType(XCA_TREND_BULL) ||
iBox.type == GetBoxType(XCA_TREND_BEAR)
//
;
if (!isTypePassed)
ENUM_XCA_PIVOTS iType = GetPivotType(iBox);
bool isAllowedType = IsValid(iType) &&
!HasChild(allowedTypes)
? true
: Contains(
iType,
allowedTypes //
);
if (!isAllowedType)
{
//
iBox.Clean();
@@ -1314,12 +1375,18 @@ bool SelectRejectedBox(
//
ENUM_XCA_PIVOTS iType = GetPivotType(iBox);
bool isAllowedType = IsValid(iType) &&
Contains(
iType,
allowedTypes //
);
!HasChild(allowedTypes)
? true
: Contains(
iType,
allowedTypes //
);
if (!isAllowedType)
{
//
iBox.Clean();
//
continue;
}