apply correction on fvg cond signalling ...
This commit is contained in:
@@ -2735,6 +2735,100 @@ class XCBarAnalyser : public XCBase
|
|||||||
return result;
|
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:
|
protected:
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -665,9 +665,40 @@ bool DetectXCAEAConditions(
|
|||||||
conditions
|
conditions
|
||||||
.GenerateSummary();
|
.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 ...
|
// Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// SAR ...
|
||||||
|
double zSar = conditions.sarBuffer[zIDX];
|
||||||
|
double cSar = conditions.sarBuffer[cIDX];
|
||||||
|
double pSar = conditions.sarBuffer[pIDX];
|
||||||
|
double p2Sar = conditions.sarBuffer[p2IDX];
|
||||||
|
|
||||||
//
|
//
|
||||||
// PEAK ...
|
// PEAK ...
|
||||||
double zPeak = conditions.peakBuffer[zIDX];
|
double zPeak = conditions.peakBuffer[zIDX];
|
||||||
@@ -797,7 +828,8 @@ bool DetectXCAEAConditions(
|
|||||||
z3MAMediumState > 0 &&
|
z3MAMediumState > 0 &&
|
||||||
c3MAMediumState > 0 &&
|
c3MAMediumState > 0 &&
|
||||||
z3MAMedium > z3MASlow &&
|
z3MAMedium > z3MASlow &&
|
||||||
c3MAMedium > c3MASlow
|
c3MAMedium > c3MASlow &&
|
||||||
|
conditions.isVidyaBullish
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -809,7 +841,8 @@ bool DetectXCAEAConditions(
|
|||||||
z3MAMediumState < 0 &&
|
z3MAMediumState < 0 &&
|
||||||
c3MAMediumState < 0 &&
|
c3MAMediumState < 0 &&
|
||||||
z3MAMedium < z3MASlow &&
|
z3MAMedium < z3MASlow &&
|
||||||
c3MAMedium < c3MASlow
|
c3MAMedium < c3MASlow &&
|
||||||
|
conditions.isVidyaBearish
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -832,7 +865,18 @@ bool DetectXCAEAConditions(
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Select Inside Boxes ...
|
// 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(
|
insidePivotsCount = SelectInsideBoxes(
|
||||||
|
allowedInsidePivots,
|
||||||
insidePivots,
|
insidePivots,
|
||||||
pivots,
|
pivots,
|
||||||
zBar,
|
zBar,
|
||||||
@@ -840,17 +884,19 @@ bool DetectXCAEAConditions(
|
|||||||
pBar,
|
pBar,
|
||||||
p2Bar //
|
p2Bar //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
hasInsidePivots = IsValidSize(insidePivotsCount);
|
hasInsidePivots = IsValidSize(insidePivotsCount);
|
||||||
if (hasInsidePivots)
|
if (hasInsidePivots)
|
||||||
{
|
{
|
||||||
// drawer.DrawBoxes(insidePivots, TimeCurrent());
|
//
|
||||||
|
// drawer.DrawBoxes(
|
||||||
|
// insidePivots,
|
||||||
|
// zBar.time //
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Rejected Pivot ...
|
// Detect Rejected Pivot ...
|
||||||
ENUM_XCA_PIVOTS allowedPivots[] = {
|
ENUM_XCA_PIVOTS allowedRejectedPivots[] = {
|
||||||
XCA_FVG_BULL,
|
XCA_FVG_BULL,
|
||||||
XCA_FVG_BEAR,
|
XCA_FVG_BEAR,
|
||||||
// XCA_PEAKSWHRES,
|
// XCA_PEAKSWHRES,
|
||||||
@@ -859,7 +905,7 @@ bool DetectXCAEAConditions(
|
|||||||
// XCA_TREND_BEAR,
|
// XCA_TREND_BEAR,
|
||||||
};
|
};
|
||||||
has = SelectRejectedBox(
|
has = SelectRejectedBox(
|
||||||
allowedPivots,
|
allowedRejectedPivots,
|
||||||
rejectedPivot,
|
rejectedPivot,
|
||||||
isRejectedOnMid,
|
isRejectedOnMid,
|
||||||
pivots,
|
pivots,
|
||||||
@@ -871,14 +917,6 @@ bool DetectXCAEAConditions(
|
|||||||
true,
|
true,
|
||||||
true //
|
true //
|
||||||
);
|
);
|
||||||
// if (has)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// drawer.DrawBox(
|
|
||||||
// rejectedPivot,
|
|
||||||
// TimeCurrent() //
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -890,6 +928,10 @@ bool DetectXCAEAConditions(
|
|||||||
//
|
//
|
||||||
bool isCond1Bullish =
|
bool isCond1Bullish =
|
||||||
//
|
//
|
||||||
|
// false && // TODO: Remove this ...
|
||||||
|
isVolumeOverAvg &&
|
||||||
|
isVolumeOverLast &&
|
||||||
|
conditions.isSarBullish &&
|
||||||
rejectedPivot.IsValid() &&
|
rejectedPivot.IsValid() &&
|
||||||
rejectedPivot.IsBullish() &&
|
rejectedPivot.IsBullish() &&
|
||||||
isX3MaValidForBullishRejection
|
isX3MaValidForBullishRejection
|
||||||
@@ -899,6 +941,10 @@ bool DetectXCAEAConditions(
|
|||||||
//
|
//
|
||||||
bool isCond1Bearish =
|
bool isCond1Bearish =
|
||||||
//
|
//
|
||||||
|
// false && // TODO: Remove this ...
|
||||||
|
isVolumeOverAvg &&
|
||||||
|
isVolumeOverLast &&
|
||||||
|
conditions.isSarBearish &&
|
||||||
rejectedPivot.IsValid() &&
|
rejectedPivot.IsValid() &&
|
||||||
rejectedPivot.IsBearish() &&
|
rejectedPivot.IsBearish() &&
|
||||||
isX3MaValidForBearishRejection
|
isX3MaValidForBearishRejection
|
||||||
@@ -918,6 +964,9 @@ bool DetectXCAEAConditions(
|
|||||||
rejectedPivot,
|
rejectedPivot,
|
||||||
TimeCurrent() //
|
TimeCurrent() //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Print("Cond1");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -926,9 +975,19 @@ bool DetectXCAEAConditions(
|
|||||||
//
|
//
|
||||||
bool isCond2Bullish =
|
bool isCond2Bullish =
|
||||||
//
|
//
|
||||||
false &&
|
// false &&
|
||||||
isX3MaBearishState &&
|
//
|
||||||
isCBarBullishRejected // &&
|
c3MASlowState > 0 &&
|
||||||
|
c3MAMediumState > 0 &&
|
||||||
|
cBar.GetUp() > pSar &&
|
||||||
|
conditions.isFastOverSlow &&
|
||||||
|
conditions.isVidyaBullish &&
|
||||||
|
conditions.isFastOverMedium &&
|
||||||
|
conditions.isSarSwitchedToBullish
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// isX3MaBearishState &&
|
||||||
|
// isCBarBullishRejected // &&
|
||||||
// cBar.GetDown() > pVale &&
|
// cBar.GetDown() > pVale &&
|
||||||
// conditions.isValeUnderLast
|
// conditions.isValeUnderLast
|
||||||
//
|
//
|
||||||
@@ -937,9 +996,9 @@ bool DetectXCAEAConditions(
|
|||||||
//
|
//
|
||||||
bool isCond2Bearish =
|
bool isCond2Bearish =
|
||||||
//
|
//
|
||||||
false &&
|
false // &&
|
||||||
isX3MaBullishState &&
|
// isX3MaBullishState &&
|
||||||
isCBarBearishRejected // &&
|
// isCBarBearishRejected // &&
|
||||||
// cBar.GetUp() < pPeak &&
|
// cBar.GetUp() < pPeak &&
|
||||||
// conditions.isPeakOverLast
|
// conditions.isPeakOverLast
|
||||||
//
|
//
|
||||||
@@ -951,7 +1010,7 @@ bool DetectXCAEAConditions(
|
|||||||
if (isCond2)
|
if (isCond2)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Print("Cond2");
|
Print("Cond2");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1166,6 +1225,7 @@ bool DetectXCAEAConditions(
|
|||||||
//
|
//
|
||||||
// Select Inside Boxes ...
|
// Select Inside Boxes ...
|
||||||
int SelectInsideBoxes(
|
int SelectInsideBoxes(
|
||||||
|
ENUM_XCA_PIVOTS &allowedTypes[],
|
||||||
XBoxZone &insideBoxes[],
|
XBoxZone &insideBoxes[],
|
||||||
XBoxZone &boxes[],
|
XBoxZone &boxes[],
|
||||||
XOHCL &zBar,
|
XOHCL &zBar,
|
||||||
@@ -1200,14 +1260,15 @@ int SelectInsideBoxes(
|
|||||||
XBoxZone iBox = boxes[i];
|
XBoxZone iBox = boxes[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Box Type ...
|
ENUM_XCA_PIVOTS iType = GetPivotType(iBox);
|
||||||
bool isTypePassed =
|
bool isAllowedType = IsValid(iType) &&
|
||||||
//
|
!HasChild(allowedTypes)
|
||||||
iBox.type == GetBoxType(XCA_TREND_BULL) ||
|
? true
|
||||||
iBox.type == GetBoxType(XCA_TREND_BEAR)
|
: Contains(
|
||||||
//
|
iType,
|
||||||
;
|
allowedTypes //
|
||||||
if (!isTypePassed)
|
);
|
||||||
|
if (!isAllowedType)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
iBox.Clean();
|
iBox.Clean();
|
||||||
@@ -1314,12 +1375,18 @@ bool SelectRejectedBox(
|
|||||||
//
|
//
|
||||||
ENUM_XCA_PIVOTS iType = GetPivotType(iBox);
|
ENUM_XCA_PIVOTS iType = GetPivotType(iBox);
|
||||||
bool isAllowedType = IsValid(iType) &&
|
bool isAllowedType = IsValid(iType) &&
|
||||||
Contains(
|
!HasChild(allowedTypes)
|
||||||
iType,
|
? true
|
||||||
allowedTypes //
|
: Contains(
|
||||||
);
|
iType,
|
||||||
|
allowedTypes //
|
||||||
|
);
|
||||||
if (!isAllowedType)
|
if (!isAllowedType)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -210,10 +210,14 @@ class XCXCAEASignaller : XCBase
|
|||||||
//
|
//
|
||||||
// Draw Founded Pivots ...
|
// Draw Founded Pivots ...
|
||||||
// drawer.Draw(cTime);
|
// drawer.Draw(cTime);
|
||||||
drawer.DrawPeakResSWHPivots(cTime);
|
|
||||||
drawer.DrawValeSupSWLPivots(cTime);
|
//
|
||||||
drawer.DrawFVGBullishPivots(cTime);
|
// drawer.DrawPeakResSWHPivots(cTime);
|
||||||
drawer.DrawFVGBearishPivots(cTime);
|
// drawer.DrawValeSupSWLPivots(cTime);
|
||||||
|
// drawer.DrawFVGBullishPivots(cTime);
|
||||||
|
// drawer.DrawFVGBearishPivots(cTime);
|
||||||
|
// drawer.DrawRSICrossedOverOSPivots(cTime);
|
||||||
|
// drawer.DrawRSICrossedUnderOBPivots(cTime);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retrieve Valid Pviots ...
|
// Retrieve Valid Pviots ...
|
||||||
@@ -817,10 +821,10 @@ class XCXCAEASignaller : XCBase
|
|||||||
//
|
//
|
||||||
inputs.caInputs.showKI = false;
|
inputs.caInputs.showKI = false;
|
||||||
inputs.caInputs.showTKI = false;
|
inputs.caInputs.showTKI = false;
|
||||||
inputs.caInputs.showSar = false;
|
inputs.caInputs.showSar = true;
|
||||||
inputs.caInputs.showVidya = false;
|
inputs.caInputs.showVidya = true;
|
||||||
inputs.caInputs.showTrend = false;
|
inputs.caInputs.showTrend = true;
|
||||||
inputs.caInputs.showSwings = false;
|
inputs.caInputs.showSwings = true;
|
||||||
inputs.caInputs.showLongCycle = false;
|
inputs.caInputs.showLongCycle = false;
|
||||||
inputs.caInputs.showHindCycle = false;
|
inputs.caInputs.showHindCycle = false;
|
||||||
inputs.caInputs.showFiboLevel1 = false;
|
inputs.caInputs.showFiboLevel1 = false;
|
||||||
@@ -914,10 +918,10 @@ class XCXCAEASignaller : XCBase
|
|||||||
drawer.drawPeakResSWHPivots = true;
|
drawer.drawPeakResSWHPivots = true;
|
||||||
drawer.drawTrendBullishPivots = false;
|
drawer.drawTrendBullishPivots = false;
|
||||||
drawer.drawTrendBearishPivots = false;
|
drawer.drawTrendBearishPivots = false;
|
||||||
drawer.drawRSICrossedOverOSPivots = false;
|
|
||||||
drawer.drawRSICrossedUnderOBPivots = false;
|
|
||||||
drawer.drawCCICrossedOverOSPivots = false;
|
drawer.drawCCICrossedOverOSPivots = false;
|
||||||
drawer.drawCCICrossedUnderOBPivots = false;
|
drawer.drawCCICrossedUnderOBPivots = false;
|
||||||
|
drawer.drawRSICrossedOverOSPivots = true;
|
||||||
|
drawer.drawRSICrossedUnderOBPivots = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Configure Widths ...
|
// Configure Widths ...
|
||||||
|
|||||||
Reference in New Issue
Block a user