This commit is contained in:
2025-04-26 17:40:03 +03:30
parent e1bcf58bc8
commit 94878bdea2
9 changed files with 4063 additions and 540 deletions
File diff suppressed because it is too large Load Diff
+323 -11
View File
@@ -56,6 +56,10 @@ class XCXCAEAPOIDrawer : public XCBase
bool drawPeakResSWHPivots;
bool drawPVFVGBullishPivots;
bool drawPVFVGBearishPivots;
bool drawRSICrossedOverOSPivots;
bool drawRSICrossedUnderOBPivots;
bool drawCCICrossedOverOSPivots;
bool drawCCICrossedUnderOBPivots;
//
// Colors ...
@@ -79,7 +83,11 @@ class XCXCAEAPOIDrawer : public XCBase
color trendLineBearishColor;
color pvFVGBullishPivotsColor;
color pvFVGBearishPivotsColor;
color rsiCrossedOverOSPivotsColor;
color rsiCrossedUnderOBPivotsColor;
color cciCrossedOverOSPivotsColor;
color cciCrossedUnderOBPivotsColor;
//
// Width ...
@@ -102,6 +110,10 @@ class XCXCAEAPOIDrawer : public XCBase
int trendLineBearishWidth;
int pvFVGBullishPivotsWidth;
int pvFVGBearishPivotsWidth;
int rsiCrossedOverOSPivotsWidth;
int rsiCrossedUnderOBPivotsWidth;
int cciCrossedOverOSPivotsWidth;
int cciCrossedUnderOBPivotsWidth;
//
// Style ...
@@ -125,6 +137,10 @@ class XCXCAEAPOIDrawer : public XCBase
ENUM_LINE_STYLE trendLineBearishStyle;
ENUM_LINE_STYLE pvFVGBullishPivotsStyle;
ENUM_LINE_STYLE pvFVGBearishPivotsStyle;
ENUM_LINE_STYLE rsiCrossedOverOSPivotsStyle;
ENUM_LINE_STYLE rsiCrossedUnderOBPivotsStyle;
ENUM_LINE_STYLE cciCrossedOverOSPivotsStyle;
ENUM_LINE_STYLE cciCrossedUnderOBPivotsStyle;
//
// Colorize Props ...
@@ -187,6 +203,10 @@ class XCXCAEAPOIDrawer : public XCBase
drawPeakResSWHPivots = false;
drawPVFVGBullishPivots = false;
drawPVFVGBearishPivots = false;
drawRSICrossedOverOSPivots = false;
drawRSICrossedUnderOBPivots = false;
drawCCICrossedOverOSPivots = false;
drawCCICrossedUnderOBPivots = false;
//
defaultBullishColor = clrLime;
@@ -203,7 +223,9 @@ class XCXCAEAPOIDrawer : public XCBase
valeSupSWLPivotsColor = defaultBullishColor;
trendLineBullishColor = defaultBullishColor;
pvFVGBullishPivotsColor = defaultBullishColor;
rsiCrossedOverOSPivotsColor = defaultBullishColor;
cciCrossedOverOSPivotsColor = defaultBullishColor;
//
rsiPeakPivotsColor = defaultBearishColor;
cciPeakPivotsColor = defaultBearishColor;
@@ -211,15 +233,17 @@ class XCXCAEAPOIDrawer : public XCBase
peakResSWHPivotsColor = defaultBearishColor;
trendLineBearishColor = defaultBearishColor;
pvFVGBearishPivotsColor = defaultBearishColor;
rsiCrossedUnderOBPivotsColor = defaultBearishColor;
cciCrossedUnderOBPivotsColor = defaultBearishColor;
//
defaultBullishWidth = 1;
defaultBearishWidth = 1;
//
tickPivotsWidth = defaultBullishWidth;
volumePivotsWidth = defaultBearishWidth;
//
rsiValePivotsWidth = defaultBullishWidth;
cciValePivotsWidth = defaultBullishWidth;
@@ -227,7 +251,9 @@ class XCXCAEAPOIDrawer : public XCBase
valeSupSWLPivotsWidth = defaultBullishWidth;
trendLineBullishWidth = defaultBullishWidth;
pvFVGBullishPivotsWidth = defaultBullishWidth;
rsiCrossedOverOSPivotsWidth = defaultBullishWidth;
cciCrossedOverOSPivotsWidth = defaultBullishWidth;
//
rsiPeakPivotsWidth = defaultBearishWidth;
cciPeakPivotsWidth = defaultBearishWidth;
@@ -235,15 +261,17 @@ class XCXCAEAPOIDrawer : public XCBase
peakResSWHPivotsWidth = defaultBearishWidth;
trendLineBearishWidth = defaultBearishWidth;
pvFVGBearishPivotsWidth = defaultBearishWidth;
rsiCrossedUnderOBPivotsWidth = defaultBearishWidth;
cciCrossedUnderOBPivotsWidth = defaultBearishWidth;
//
defaultBullishStyle = STYLE_SOLID;
defaultBearishStyle = STYLE_SOLID;
//
tickPivotsStyle = defaultBullishStyle;
volumePivotsStyle = defaultBearishStyle;
//
rsiValePivotsStyle = defaultBullishStyle;
cciValePivotsStyle = defaultBullishStyle;
@@ -251,7 +279,9 @@ class XCXCAEAPOIDrawer : public XCBase
valeSupSWLPivotsStyle = defaultBullishStyle;
trendLineBullishStyle = defaultBullishStyle;
pvFVGBullishPivotsStyle = defaultBullishStyle;
rsiCrossedOverOSPivotsStyle = defaultBullishStyle;
cciCrossedOverOSPivotsStyle = defaultBullishStyle;
//
rsiPeakPivotsStyle = defaultBearishStyle;
cciPeakPivotsStyle = defaultBearishStyle;
@@ -259,6 +289,8 @@ class XCXCAEAPOIDrawer : public XCBase
peakResSWHPivotsStyle = defaultBearishStyle;
trendLineBearishStyle = defaultBearishStyle;
pvFVGBearishPivotsStyle = defaultBearishStyle;
rsiCrossedUnderOBPivotsStyle = defaultBearishStyle;
cciCrossedUnderOBPivotsStyle = defaultBearishStyle;
}
//
@@ -278,6 +310,10 @@ class XCXCAEAPOIDrawer : public XCBase
DrawPeakResSWHPivots(to);
DrawPVFVGBullishPivots(to);
DrawPVFVGBearishPivots(to);
DrawRSICrossedOverOSPivots(to);
DrawRSICrossedUnderOBPivots(to);
DrawCCICrossedOverOSPivots(to);
DrawCCICrossedUnderOBPivots(to);
}
//
@@ -297,6 +333,10 @@ class XCXCAEAPOIDrawer : public XCBase
mPeakResSWHPivotObjects.Clear();
mPVFVGBullishPivotObjects.Clear();
mPVFVGBearishPivotObjects.Clear();
mRSICrossedOverOSPivotObjects.Clear();
mRSICrossedUnderOBPivotObjects.Clear();
mCCICrossedOverOSPivotObjects.Clear();
mCCICrossedUnderOBPivotObjects.Clear();
}
//
@@ -312,6 +352,9 @@ class XCXCAEAPOIDrawer : public XCBase
return;
}
//
mTrendLineObjects.Clear();
//
ENUM_X_DIRECTION trend = X_DIRECTION_NONE;
bool has = detector.MarketTrend(trend);
@@ -333,7 +376,7 @@ class XCXCAEAPOIDrawer : public XCBase
: detector.trendPivotP.upper;
//
datetime pTime = detector.trendPivotC.from;
datetime pTime = detector.trendPivotP.from;
//
double cPrice = hasBullishTrend
@@ -384,6 +427,7 @@ class XCXCAEAPOIDrawer : public XCBase
iObj.Color(tlColor);
iObj.Width(tlWidth);
iObj.Style(tlStyle);
iObj.RayRight(true);
//
// Store Object ...
@@ -1124,6 +1168,270 @@ class XCXCAEAPOIDrawer : public XCBase
}
}
//
void DrawRSICrossedOverOSPivots(datetime to = NULL)
{
//
bool has = drawRSICrossedOverOSPivots;
if (!has)
{
return;
}
//
has = detector.HasRSICrossedOverOSPivots();
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
//
bool canUpdateTo = IsValid(to);
//
int count = detector.CountRSICrossedOverOSPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.rsiCrossedOverOSPivots[i];
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
//
if (has)
{
//
// Style Object ...
iObj.BoxColor(rsiCrossedOverOSPivotsColor);
iObj.BoxWidth(rsiCrossedOverOSPivotsWidth);
iObj.BoxStyle(rsiCrossedOverOSPivotsStyle);
//
// Store Object ...
mRSICrossedOverOSPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
//
void DrawRSICrossedUnderOBPivots(datetime to = NULL)
{
//
bool has = drawRSICrossedUnderOBPivots;
if (!has)
{
return;
}
//
has = detector.HasRSICrossedUnderOBPivots();
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
//
bool canUpdateTo = IsValid(to);
//
int count = detector.CountRSICrossedUnderOBPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.rsiCrossedUnderOBPivots[i];
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
//
if (has)
{
//
// Style Object ...
iObj.BoxColor(rsiCrossedUnderOBPivotsColor);
iObj.BoxWidth(rsiCrossedUnderOBPivotsWidth);
iObj.BoxStyle(rsiCrossedUnderOBPivotsStyle);
//
// Store Object ...
mRSICrossedUnderOBPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
//
void DrawCCICrossedOverOSPivots(datetime to = NULL)
{
//
bool has = drawCCICrossedOverOSPivots;
if (!has)
{
return;
}
//
has = detector.HasCCICrossedOverOSPivots();
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
//
bool canUpdateTo = IsValid(to);
//
int count = detector.CountCCICrossedOverOSPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.cciCrossedOverOSPivots[i];
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
//
if (has)
{
//
// Style Object ...
iObj.BoxColor(cciCrossedOverOSPivotsColor);
iObj.BoxWidth(cciCrossedOverOSPivotsWidth);
iObj.BoxStyle(cciCrossedOverOSPivotsStyle);
//
// Store Object ...
mCCICrossedOverOSPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
//
void DrawCCICrossedUnderOBPivots(datetime to = NULL)
{
//
bool has = drawCCICrossedUnderOBPivots;
if (!has)
{
return;
}
//
has = detector.HasCCICrossedUnderOBPivots();
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
//
bool canUpdateTo = IsValid(to);
//
int count = detector.CountCCICrossedUnderOBPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.cciCrossedUnderOBPivots[i];
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
//
if (has)
{
//
// Style Object ...
iObj.BoxColor(cciCrossedUnderOBPivotsColor);
iObj.BoxWidth(cciCrossedUnderOBPivotsWidth);
iObj.BoxStyle(cciCrossedUnderOBPivotsStyle);
//
// Store Object ...
mCCICrossedUnderOBPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
//
// Protected ...
protected:
@@ -1154,6 +1462,10 @@ class XCXCAEAPOIDrawer : public XCBase
CArrayObj mPeakResSWHPivotObjects;
CArrayObj mPVFVGBullishPivotObjects;
CArrayObj mPVFVGBearishPivotObjects;
CArrayObj mRSICrossedOverOSPivotObjects;
CArrayObj mRSICrossedUnderOBPivotObjects;
CArrayObj mCCICrossedOverOSPivotObjects;
CArrayObj mCCICrossedUnderOBPivotObjects;
//
};
+286 -2
View File
@@ -28,6 +28,7 @@
#include "../../Helpers/x-saherelm.x121.xca.helper.mq5"
#include "../../Helpers/x-saherelm.x121.xcc.helper.mq5"
#include "../../Helpers/x-saherelm.x121.xct.helper.mq5"
#include "../../Helpers/x-saherelm.x121.x3ma.helper.mq5"
#include "../../Helpers/x-saherelm.x121.xoscs.helper.mq5"
//
@@ -51,6 +52,7 @@ struct XCAEAInputs
X121XCTInputs ctInputs;
X121XCCInputs ccInputs;
X121XCAInputs caInputs;
X121X3MAInputs x3maInputs;
X121XOCSInputs oscsInputs;
//
@@ -85,6 +87,7 @@ struct XCAEAInputs
ctInputs.Clean();
ccInputs.Clean();
caInputs.Clean();
x3maInputs.Clean();
oscsInputs.Clean();
//
@@ -100,6 +103,7 @@ struct XCAEAInputs
ctInputs.Default();
ccInputs.Default();
caInputs.Default();
x3maInputs.Default();
oscsInputs.Default();
}
@@ -119,7 +123,8 @@ struct XCAEAInputs
ctInputs.IsValid() &&
ccInputs.IsValid() &&
caInputs.IsValid() &&
oscsInputs.IsValid()
x3maInputs.IsValid() &&
oscsInputs.IsValid()
//
;
@@ -142,11 +147,13 @@ struct XCAEAInputs
int ccMax = ccInputs.Max();
int caMax = caInputs.Max();
int ocsMax = oscsInputs.Max();
int x3maMax = x3maInputs.Max();
//
result = MathMax(ctMax, ccMax);
result = MathMax(result, caMax);
result = MathMax(result, ocsMax);
result = MathMax(result, x3maMax);
//
return result;
@@ -167,6 +174,47 @@ struct XCAEAConditions
datetime to;
datetime from;
//
// X3MA ...
//
// Buffers ...
//
double fastBuffer[];
double mediumBuffer[];
double slowBuffer[];
double fastStateBuffer[];
double mediumStateBuffer[];
double slowStateBuffer[];
//
// Conditions ...
//
bool isFastOverMedium;
bool isFastUnderMedium;
//
bool isFastCrossedOverMedium;
bool isFastCrossedUnderMedium;
//
bool isFastOverSlow;
bool isFastUnderSlow;
//
bool isFastCrossedOverSlow;
bool isFastCrossedUnderSlow;
//
bool isMediumOverSlow;
bool isMediumUnderSlow;
//
bool isMediumCrossedOverSlow;
bool isMediumCrossedUnderSlow;
//
// XCA ...
@@ -673,6 +721,55 @@ struct XCAEAConditions
from = NULL;
time = NULL;
//
// X3MA ...
//
// Buffers ...
//
Clean(fastBuffer);
Clean(mediumBuffer);
Clean(slowBuffer);
Clean(fastStateBuffer);
Clean(mediumStateBuffer);
Clean(slowStateBuffer);
//
ArraySetAsSeries(fastBuffer, true);
ArraySetAsSeries(mediumBuffer, true);
ArraySetAsSeries(slowBuffer, true);
ArraySetAsSeries(fastStateBuffer, true);
ArraySetAsSeries(mediumStateBuffer, true);
ArraySetAsSeries(slowStateBuffer, true);
//
// Conditions ...
//
isFastOverMedium = false;
isFastUnderMedium = false;
//
isFastCrossedOverMedium = false;
isFastCrossedUnderMedium = false;
//
isFastOverSlow = false;
isFastUnderSlow = false;
//
isFastCrossedOverSlow = false;
isFastCrossedUnderSlow = false;
//
isMediumOverSlow = false;
isMediumUnderSlow = false;
//
isMediumCrossedOverSlow = false;
isMediumCrossedUnderSlow = false;
//
// XCA ...
@@ -1158,9 +1255,64 @@ struct XCAEAConditions
double minScore = 0.5;
double highScore = 1.5;
//
// X3MA ...
//
// XCA ...
//
if (isFastOverSlow)
{
bullishScore += minScore;
}
if (isFastOverMedium)
{
bullishScore += minScore;
}
if (isMediumOverSlow)
{
bullishScore += minScore;
}
if (isFastCrossedOverSlow)
{
bullishScore += score;
}
if (isFastCrossedOverMedium)
{
bullishScore += score;
}
if (isMediumCrossedOverSlow)
{
bullishScore += score;
}
//
if (isFastUnderSlow)
{
bearishScore += minScore;
}
if (isMediumUnderSlow)
{
bearishScore += minScore;
}
if (isFastUnderMedium)
{
bearishScore += minScore;
}
if (isFastCrossedUnderSlow)
{
bearishScore += score;
}
if (isFastCrossedUnderMedium)
{
bearishScore += score;
}
if (isMediumCrossedUnderSlow)
{
bearishScore += score;
}
//
// KI ...
@@ -1931,6 +2083,22 @@ struct XCAEAConditions
//
string conditionsStr =
//
//
"-----------------------" + separator +
"X3MA: " + separator +
"-----------------------" + separator +
ToString("isFastOverMedium", isFastOverMedium, ignoreFalseConditions, separator) +
ToString("isFastUnderMedium", isFastUnderMedium, ignoreFalseConditions, separator) +
ToString("isFastCrossedOverMedium", isFastCrossedOverMedium, ignoreFalseConditions, separator) +
ToString("isFastCrossedUnderMedium", isFastCrossedUnderMedium, ignoreFalseConditions, separator) +
ToString("isFastOverSlow", isFastOverSlow, ignoreFalseConditions, separator) +
ToString("isFastUnderSlow", isFastUnderSlow, ignoreFalseConditions, separator) +
ToString("isFastCrossedOverSlow", isFastCrossedOverSlow, ignoreFalseConditions, separator) +
ToString("isFastCrossedUnderSlow", isFastCrossedUnderSlow, ignoreFalseConditions, separator) +
ToString("isMediumOverSlow", isMediumOverSlow, ignoreFalseConditions, separator) +
ToString("isMediumUnderSlow", isMediumUnderSlow, ignoreFalseConditions, separator) +
ToString("isMediumCrossedOverSlow", isMediumCrossedOverSlow, ignoreFalseConditions, separator) +
ToString("isMediumCrossedUnderSlow", isMediumCrossedUnderSlow, ignoreFalseConditions, separator) +
"-----------------------" + separator +
"XCA: " + separator +
"-----------------------" + separator +
@@ -2159,6 +2327,7 @@ class XCXCAEAHelper : XCBase
XCX121XCTHelper *ctHelper;
XCX121XCAHelper *caHelper;
XCX121XOCSHelper *ocsHelper;
XCX121X3MAHelper *x3maHelper;
//
// Constructor ...
@@ -2180,6 +2349,7 @@ class XCXCAEAHelper : XCBase
ZeroMemory(ctHelper);
ZeroMemory(caHelper);
ZeroMemory(ocsHelper);
ZeroMemory(x3maHelper);
//
ZeroMemory(poiDrawer);
@@ -2310,6 +2480,17 @@ class XCXCAEAHelper : XCBase
mInputs.oscsInputs //
);
//
// X3MA ...
x3maHelper = new XCX121X3MAHelper();
result =
result &&
x3maHelper.Init(
symbol,
period,
mInputs.x3maInputs //
);
//
if (!result)
{
@@ -2318,6 +2499,7 @@ class XCXCAEAHelper : XCBase
ZeroMemory(ctHelper);
ZeroMemory(caHelper);
ZeroMemory(ocsHelper);
ZeroMemory(x3maHelper);
//
ZeroMemory(poiDrawer);
@@ -2539,6 +2721,7 @@ class XCXCAEAHelper : XCBase
ZeroMemory(ctHelper);
ZeroMemory(caHelper);
ZeroMemory(ocsHelper);
ZeroMemory(x3maHelper);
//
IndicatorRelease(acHandler);
@@ -2564,6 +2747,35 @@ class XCXCAEAHelper : XCBase
//
// Conditions Readers ...
/**
* Retrieve Conditions ...
*
* @param conditions: Argument 1
* @param barIndex: int, Specified Bar Index ...
* @param loopback: int, Loopback looking for others ...
*
* @return ( bool )
*/
bool Get3MAConditions(
X121X3MAConditions &conditions, //
int barIndex = 0, //
int loopback = 5 //
)
{
//
bool result = false;
//
result = x3maHelper.GetConditions(
conditions,
barIndex,
loopback //
);
//
return result;
}
/**
* Retrieve Conditions ...
*
@@ -2631,6 +2843,7 @@ class XCXCAEAHelper : XCBase
//
caHelper.Free();
ocsHelper.Free();
x3maHelper.Free();
}
//
@@ -2672,6 +2885,7 @@ class XCXCAEAHelper : XCBase
//
X121XCAConditions xcaConditions;
X121XOCSConditions xocsConditions;
X121X3MAConditions x3maConditions;
//
result = zBar.Init(
@@ -2682,7 +2896,7 @@ class XCXCAEAHelper : XCBase
result =
result &&
zBar.GetPreviousBar(cBar);
result =
result =
result &&
cBar.GetPreviousBar(pBar);
result =
@@ -2715,6 +2929,16 @@ class XCXCAEAHelper : XCBase
loopback //
);
//
// X3MA ...
result =
result &&
Get3MAConditions(
x3maConditions,
barIndex,
loopback //
);
//
// Check Result ...
if (!result)
@@ -2728,6 +2952,7 @@ class XCXCAEAHelper : XCBase
//
xcaConditions.Clean();
xocsConditions.Clean();
x3maConditions.Clean();
//
return result;
@@ -2745,6 +2970,65 @@ class XCXCAEAHelper : XCBase
int cIDX = 1;
int pIDX = cIDX + 1;
//
// X3MA ...
//
// Buffers ...
//
Copy (
x3maConditions.fastBuffer,
conditions.fastBuffer //
);
//
Copy (
x3maConditions.mediumBuffer,
conditions.mediumBuffer //
);
//
Copy (
x3maConditions.slowBuffer,
conditions.slowBuffer //
);
//
Copy (
x3maConditions.fastStateBuffer,
conditions.fastStateBuffer //
);
//
Copy (
x3maConditions.mediumStateBuffer,
conditions.mediumStateBuffer //
);
//
Copy (
x3maConditions.slowStateBuffer,
conditions.slowStateBuffer //
);
//
// Conditions ...
//
conditions.isFastOverSlow = x3maConditions.isFastOverSlow;
conditions.isFastUnderSlow = x3maConditions.isFastUnderSlow;
conditions.isFastOverMedium = x3maConditions.isFastOverMedium;
conditions.isMediumOverSlow = x3maConditions.isMediumOverSlow;
conditions.isFastUnderMedium = x3maConditions.isFastUnderMedium;
conditions.isMediumUnderSlow = x3maConditions.isMediumUnderSlow;
conditions.isFastCrossedOverSlow = x3maConditions.isFastCrossedOverSlow;
conditions.isFastCrossedUnderSlow = x3maConditions.isFastCrossedUnderSlow;
conditions.isFastCrossedOverMedium = x3maConditions.isFastCrossedOverMedium;
conditions.isMediumCrossedOverSlow = x3maConditions.isMediumCrossedOverSlow;
conditions.isFastCrossedUnderMedium = x3maConditions.isFastCrossedUnderMedium;
conditions.isMediumCrossedUnderSlow = x3maConditions.isMediumCrossedUnderSlow;
//
// XCA ...
+144 -63
View File
@@ -665,76 +665,39 @@ bool DetectXCAEAConditions(
//
// Conditions ...
//
double zPeak = conditions.peakBuffer[zIDX];
double cPeak = conditions.peakBuffer[cIDX];
double pPeak = conditions.peakBuffer[pIDX];
double p2Peak = conditions.peakBuffer[p2IDX];
//
double zVale = conditions.valeBuffer[zIDX];
double cVale = conditions.valeBuffer[cIDX];
double pVale = conditions.valeBuffer[pIDX];
double p2Vale = conditions.valeBuffer[p2IDX];
//
// Parsing Pivots ...
//
// Detect Selected Pivot ...
XBoxZone lastOSCPivot;
XBoxZone rejectedPivot;
double providedSL = 0;
bool hasPivots = HasChild(pivots);
if (hasPivots)
{
//
// Detect Selected Pivots ...
count = ArraySize(pivots);
for (int i = 0; i < count; i++)
{
//
XBoxZone iPivot = pivots[i];
//
// Detect Selected Last OSC Pivots ...
bool isOSC =
Contains(
"XCA_RSI",
iPivot.type //
) ||
Contains(
"XCA_CCI",
iPivot.type //
);
bool canSetOSC =
!isOSC
? false
: !lastOSCPivot.IsValid()
? true
: lastOSCPivot.from < iPivot.from;
if (canSetOSC)
{
lastOSCPivot = iPivot;
}
//
iPivot.Clean();
//
}
}
//
// Detect New OSC Pivot Happens ...
bool hasNewOSC = lastOSCPivot.IsValid() &&
cBar.time == lastOSCPivot.to;
if (hasNewOSC)
{
//
XCBoxObject *iObj;
has = helper.poiDrawer.DrawBox(
lastOSCPivot,
iObj //
has = SelectRejectedBox(
rejectedPivot,
pivots,
zBar,
cBar,
pBar,
p2Bar,
true,
true //
);
if (has)
{
//
iObj.BoxWidth(2);
//
Print("OSC Box Detected ...");
}
//
ZeroMemory(iObj);
}
//
@@ -773,6 +736,8 @@ bool DetectXCAEAConditions(
//
Print("Cond1");
isCond1Bullish = false;
isCond1Bearish = false;
}
//
@@ -926,9 +891,6 @@ bool DetectXCAEAConditions(
conditions.Clean();
}
//
lastOSCPivot.Clean();
//
zBar.Clean();
cBar.Clean();
@@ -937,6 +899,125 @@ bool DetectXCAEAConditions(
p3Bar.Clean();
p4Bar.Clean();
pConditions.Clean();
rejectedPivot.Clean();
//
return result;
}
//
bool SelectRejectedBox(
XBoxZone &box,
XBoxZone &boxes[],
XOHCL &zBar,
XOHCL &cBar,
XOHCL &pBar,
XOHCL &p2Bar,
bool forceBarType = false,
bool forcePressure = false //
)
{
//
bool result = false;
//
box.Clean();
//
// Validate ...
result = HasChild(boxes) &&
zBar.IsValid() &&
cBar.IsValid() &&
pBar.IsValid() &&
p2Bar.IsValid();
if (!result)
{
return result;
}
//
int count = ArraySize(boxes);
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = boxes[i];
//
bool isBullish = iBox.IsBullish();
bool isBearish = iBox.IsBearish();
//
double boundaryPrice =
isBullish
? iBox.upper
: iBox.lower;
//
double midPrice =
iBox.lower +
((iBox.upper - iBox.lower) / 2);
//
bool isMidBullishRejected = cBar.IsRejected(
midPrice,
X_DIRECTION_BULLISH,
forceBarType,
forcePressure //
);
//
bool isBoundaryBullishRejected = cBar.IsRejected(
boundaryPrice,
X_DIRECTION_BULLISH,
forceBarType,
forcePressure //
);
//
bool isMidBearishRejected = cBar.IsRejected(
midPrice,
X_DIRECTION_BEARISH,
forceBarType,
forcePressure //
);
//
bool isBoundaryBearishRejected = cBar.IsRejected(
boundaryPrice,
X_DIRECTION_BEARISH,
forceBarType,
forcePressure //
);
//
bool isBullishRejected =
isBullish &&
(isMidBullishRejected ||
isBoundaryBullishRejected);
//
bool isBearishRejected =
isBearish &&
(isMidBearishRejected ||
isBoundaryBearishRejected);
//
bool isRejected =
isBullishRejected ||
isBearishRejected;
if (isRejected)
{
//
box = iBox;
break;
}
//
iBox.Clean();
}
//
result = box.IsValid();
//
return result;
+151 -21
View File
@@ -40,9 +40,11 @@ class XCXCAEASignaller : XCBase
//
// Props ...
bool useGuards;
int poiLoopback;
XCAEAInputs inputs;
XBarTracker barTraker;
XCXCAEAHelper *helper;
bool rfOnInvalidPivots;
XCXCAEAPOIDrawer *drawer;
bool continuesRFTillTarget;
XBoxZone unAvailableBoxes[];
@@ -192,6 +194,12 @@ class XCXCAEASignaller : XCBase
zIndex //
);
//
if (detector.pivotDetectionLoopbac > 100)
{
detector.pivotDetectionLoopbac = 100;
}
//
// Check Market Trend ...
hasTrend = detector.MarketTrend(trend);
@@ -421,7 +429,7 @@ class XCXCAEASignaller : XCBase
else
{
//
double rfReward = 1;
double rfReward = 2;
//
double rewardRF = risk * rfReward;
@@ -436,6 +444,95 @@ class XCXCAEASignaller : XCBase
mConditions.targets //
);
}
//
// Detect Rf on Invalid Pivots ...
if (rfOnInvalidPivots)
{
//
has = detector.HasInvalidPivots();
if (has)
{
//
XBoxZone targetBox;
double targetBoxPrice = 0;
count = detector.CountInvalidPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iPivot = detector.invalidPivots[i];
//
bool isValidPivot =
Contains(
"XCA_PEAKSWHRES",
iPivot.type //
) ||
Contains(
"XCA_VALESWLSUP",
iPivot.type //
) ||
Contains(
"XCA_FVG",
iPivot.type //
);
if (!isValidPivot)
{
//
iPivot.Clean();
continue;
}
//
double selectedPrice =
isBullish
? iPivot.lower - (5 * points)
: iPivot.upper + (5 * points);
//
double targetBoxSelectedPrice =
isBullish
? targetBox.lower - (5 * points)
: targetBox.upper + (5 * points);
//
bool isDirPassed = iPivot.dir = signalBoxDir;
bool isPricePassed =
isBullish
? entry < selectedPrice
: entry > selectedPrice;
bool canSetTarget =
!targetBox.IsValid()
? true
: isBullish
? targetBoxSelectedPrice > selectedPrice
: targetBoxSelectedPrice < selectedPrice;
if (canSetTarget)
{
//
targetBox = iPivot;
targetBoxPrice = targetBoxSelectedPrice;
}
//
iPivot.Clean();
}
//
if (targetBox.IsValid() &&
targetBoxPrice > 0)
{
//
Add(
targetBoxPrice,
mConditions.targets //
);
}
//
targetBox.Clean();
}
}
}
//
@@ -658,7 +755,8 @@ class XCXCAEASignaller : XCBase
{
//
useGuards = false;
continuesRFTillTarget = true;
rfOnInvalidPivots = false;
continuesRFTillTarget = false;
//
barTraker.Init(
@@ -688,10 +786,18 @@ class XCXCAEASignaller : XCBase
inputs.caInputs.supResSmoothingMode = X_MA_MODE_NONE;
//
inputs.caInputs.showKI = true;
inputs.x3maInputs.applyColor = true;
//
inputs.x3maInputs.showFast = true;
inputs.x3maInputs.showMedium = true;
inputs.x3maInputs.showSlow = true;
//
inputs.caInputs.showKI = false;
inputs.caInputs.showTKI = false;
inputs.caInputs.showSar = false;
inputs.caInputs.showVidya = true;
inputs.caInputs.showVidya = false;
inputs.caInputs.showTrend = false;
inputs.caInputs.showSwings = false;
inputs.caInputs.showLongCycle = false;
@@ -707,15 +813,19 @@ class XCXCAEASignaller : XCBase
//
// XOSCS ...
// inputs.oscsInputs.rsiLength = 5;
// inputs.oscsInputs.cciLength = 5;
inputs.oscsInputs.rsiLength = 4;
inputs.oscsInputs.rsiOBLevel = 90;
inputs.oscsInputs.rsiOSLevel = 10;
inputs.oscsInputs.cciLength = 7;
inputs.oscsInputs.cciOBLevel = 130;
inputs.oscsInputs.cciOSLevel = -130;
// inputs.oscsInputs.mfiLength = 5;
// inputs.oscsInputs.rviLength = 5;
//
// Oscillators Views ...
inputs.showCCI = false;
inputs.showRSI = false;
inputs.showCCI = false;
inputs.showMFI = false;
inputs.showRVI = false;
inputs.showADX = false;
@@ -738,23 +848,27 @@ class XCXCAEASignaller : XCBase
detector.maxAllowedPivots = 50;
detector.pivotVerifications = 5;
detector.ticksDividerInPoints = 15;
detector.pivotDetectionLoopbac = 100;
detector.pivotDetectionLoopbac = 200;
detector.ticksDetectionPerid = PERIOD_D1;
//
// Configure Detector ...
detector.detectTickPivots = true;
detector.detectVolumePivots = true;
detector.detectRSIPeakPivots = true;
detector.detectRSIValePivots = true;
detector.detectCCIPeakPivots = true;
detector.detectCCIValePivots = true;
detector.detectFVGBullishPivots = true;
detector.detectFVGBearishPivots = true;
detector.detectTickPivots = false;
detector.detectVolumePivots = false;
detector.detectRSIPeakPivots = false;
detector.detectRSIValePivots = false;
detector.detectCCIPeakPivots = false;
detector.detectCCIValePivots = false;
detector.detectFVGBullishPivots = false;
detector.detectFVGBearishPivots = false;
detector.detectValeSupSWLPivots = true;
detector.detectPeakResSWHPivots = true;
detector.detectPVFVGBullishPivots = true;
detector.detectPVFVGBearishPivots = true;
detector.detectRSICrossedOverOSPivots = true;
detector.detectRSICrossedUnderOBPivots = true;
detector.detectCCICrossedOverOSPivots = false;
detector.detectCCICrossedUnderOBPivots = false;
//
// Initialize and Configure Drawer ...
@@ -765,19 +879,23 @@ class XCXCAEASignaller : XCBase
//
// Configure Drawer ...
drawer.drawTrendLine = true;
drawer.drawTrendLine = false;
drawer.drawTickPivots = false;
drawer.drawVolumePivots = false;
drawer.drawRSIPeakPivots = true;
drawer.drawRSIValePivots = true;
drawer.drawCCIPeakPivots = true;
drawer.drawCCIValePivots = true;
drawer.drawRSIPeakPivots = false;
drawer.drawRSIValePivots = false;
drawer.drawCCIPeakPivots = false;
drawer.drawCCIValePivots = false;
drawer.drawFVGBullishPivots = false;
drawer.drawFVGBearishPivots = false;
drawer.drawValeSupSWLPivots = true;
drawer.drawPeakResSWHPivots = true;
drawer.drawPVFVGBullishPivots = true;
drawer.drawPVFVGBearishPivots = true;
drawer.drawRSICrossedOverOSPivots = true;
drawer.drawRSICrossedUnderOBPivots = true;
drawer.drawCCICrossedOverOSPivots = true;
drawer.drawCCICrossedUnderOBPivots = true;
//
// Configure Widths ...
@@ -795,6 +913,10 @@ class XCXCAEASignaller : XCBase
drawer.trendLineBullishWidth = 4;
drawer.pvFVGBullishPivotsWidth = 1;
drawer.pvFVGBearishPivotsWidth = 1;
drawer.rsiCrossedOverOSPivotsWidth = 4;
drawer.rsiCrossedUnderOBPivotsWidth = 4;
drawer.cciCrossedOverOSPivotsWidth = 4;
drawer.cciCrossedUnderOBPivotsWidth = 4;
//
// Configure Colors ...
@@ -812,6 +934,10 @@ class XCXCAEASignaller : XCBase
drawer.trendLineBullishColor = clrMagenta;
drawer.pvFVGBullishPivotsColor = clrLime;
drawer.pvFVGBearishPivotsColor = clrRed;
drawer.rsiCrossedOverOSPivotsColor = clrAqua;
drawer.rsiCrossedUnderOBPivotsColor = clrMagenta;
drawer.cciCrossedOverOSPivotsColor = clrAqua;
drawer.cciCrossedUnderOBPivotsColor = clrMagenta;
//
// Configures Styles ...
@@ -829,6 +955,10 @@ class XCXCAEASignaller : XCBase
drawer.trendLineBullishWidth = STYLE_SOLID;
drawer.pvFVGBullishPivotsStyle = STYLE_DASHDOTDOT;
drawer.pvFVGBearishPivotsStyle = STYLE_DASHDOTDOT;
drawer.rsiCrossedOverOSPivotsStyle = STYLE_DASHDOTDOT;
drawer.rsiCrossedUnderOBPivotsStyle = STYLE_DASHDOTDOT;
drawer.cciCrossedOverOSPivotsStyle = STYLE_DASHDOTDOT;
drawer.cciCrossedUnderOBPivotsStyle = STYLE_DASHDOTDOT;
//
}