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
@@ -2735,6 +2735,100 @@ class XCBarAnalyser : public XCBase
return result;
}
//
// Implement Some Custom Senarios ...
/**
* Calculate Specified Bars Range Volume ...
*
* @param bar: XOHCL instance reference ...
* @param bullishVolume: double
* @param bearishVolume: double
* @param loopback: int
*
* @return ( bool )
*/
bool CalculateRangeVolume(
XOHCL &bar,
double &bullishVolume,
double &bearishVolume,
int loopback = 5 //
)
{
//
bool result = false;
//
// Normalize Args ...
bullishVolume = 0;
bearishVolume = 0;
loopback = NormalizeInt(loopback, 3);
//
// Validate ...
result = bar.IsValid();
if (!result)
{
return result;
}
//
XOHCL iBar;
bool has = false;
int start = bar.Index();
int end = start + loopback;
for (int i = start; i <= end; i++)
{
//
iBar.Clean();
has = iBar.Init(
bar.symbol,
bar.period,
i //
);
if (!has)
{
//
iBar.Clean();
//
break;
}
//
bool isBullish = iBar.IsBullish();
bool isBearish = iBar.IsBearish();
//
if (isBullish)
{
bullishVolume += iBar.volume;
}
else if (isBearish)
{
bearishVolume += iBar.volume;
}
else
{
//
bullishVolume += iBar.volume;
bearishVolume += iBar.volume;
}
//
iBar.Clean();
}
//
result = iBar.IsValid();
//
iBar.Clean();
//
return result;
}
//
protected:
//
+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;
}
+14 -10
View File
@@ -210,10 +210,14 @@ class XCXCAEASignaller : XCBase
//
// Draw Founded Pivots ...
// drawer.Draw(cTime);
drawer.DrawPeakResSWHPivots(cTime);
drawer.DrawValeSupSWLPivots(cTime);
drawer.DrawFVGBullishPivots(cTime);
drawer.DrawFVGBearishPivots(cTime);
//
// drawer.DrawPeakResSWHPivots(cTime);
// drawer.DrawValeSupSWLPivots(cTime);
// drawer.DrawFVGBullishPivots(cTime);
// drawer.DrawFVGBearishPivots(cTime);
// drawer.DrawRSICrossedOverOSPivots(cTime);
// drawer.DrawRSICrossedUnderOBPivots(cTime);
//
// Retrieve Valid Pviots ...
@@ -817,10 +821,10 @@ class XCXCAEASignaller : XCBase
//
inputs.caInputs.showKI = false;
inputs.caInputs.showTKI = false;
inputs.caInputs.showSar = false;
inputs.caInputs.showVidya = false;
inputs.caInputs.showTrend = false;
inputs.caInputs.showSwings = false;
inputs.caInputs.showSar = true;
inputs.caInputs.showVidya = true;
inputs.caInputs.showTrend = true;
inputs.caInputs.showSwings = true;
inputs.caInputs.showLongCycle = false;
inputs.caInputs.showHindCycle = false;
inputs.caInputs.showFiboLevel1 = false;
@@ -914,10 +918,10 @@ class XCXCAEASignaller : XCBase
drawer.drawPeakResSWHPivots = true;
drawer.drawTrendBullishPivots = false;
drawer.drawTrendBearishPivots = false;
drawer.drawRSICrossedOverOSPivots = false;
drawer.drawRSICrossedUnderOBPivots = false;
drawer.drawCCICrossedOverOSPivots = false;
drawer.drawCCICrossedUnderOBPivots = false;
drawer.drawRSICrossedOverOSPivots = true;
drawer.drawRSICrossedUnderOBPivots = true;
//
// Configure Widths ...