Files
xMQL5/BKPS/14040218 XCAEA/Documents/BKP/xcaea.x-poi.drawer.class.bkp.mq5
T
2025-05-08 14:17:59 +03:30

2329 lines
49 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Indicator
// -------------------------------------------------
// Name: XCXCAEAPOIDrawer ...
// Description: Class for XCAEA POI Drawer ...
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
// Global Properties ...
#property library
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://saherelm.ir"
#property version "1.00"
#property description "SaherElm Class for XCAEA POI Drawer"
#property strict
//
// Imports ...
#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5"
#include "../Classes/xcaea.x-poi.detector.class.mq5"
//
// Definitions ...
//
// Implementations ...
class XCXCAEAPOIDrawer : public XCBase
{
//
// Public ...
public:
//
// Props ...
//
bool ignoreUpdateOSCTos;
bool drawTrendPivotsOnlySelectedFVG;
//
// Drawers ...
bool drawTrendLine;
bool drawTickPivots;
bool drawVolumePivots;
bool drawRSIPeakPivots;
bool drawRSIValePivots;
bool drawCCIPeakPivots;
bool drawCCIValePivots;
bool drawFVGBullishPivots;
bool drawFVGBearishPivots;
bool drawValeSupSWLPivots;
bool drawPeakResSWHPivots;
bool drawTrendBullishPivots;
bool drawTrendBearishPivots;
bool drawRSICrossedOverOSPivots;
bool drawRSICrossedUnderOBPivots;
bool drawCCICrossedOverOSPivots;
bool drawCCICrossedUnderOBPivots;
//
// Colors ...
//
color defaultBullishColor;
color defaultBearishColor;
//
color tickPivotsColor;
color volumePivotsColor;
color rsiPeakPivotsColor;
color rsiValePivotsColor;
color cciPeakPivotsColor;
color cciValePivotsColor;
color fvgBullishPivotsColor;
color fvgBearishPivotsColor;
color valeSupSWLPivotsColor;
color peakResSWHPivotsColor;
color trendLineBullishColor;
color trendLineBearishColor;
color trendBullishPivotsColor;
color trendBearishPivotsColor;
color rsiCrossedOverOSPivotsColor;
color rsiCrossedUnderOBPivotsColor;
color cciCrossedOverOSPivotsColor;
color cciCrossedUnderOBPivotsColor;
//
// Width ...
//
int defaultBullishWidth;
int defaultBearishWidth;
//
int tickPivotsWidth;
int volumePivotsWidth;
int rsiPeakPivotsWidth;
int rsiValePivotsWidth;
int cciPeakPivotsWidth;
int cciValePivotsWidth;
int fvgBullishPivotsWidth;
int fvgBearishPivotsWidth;
int valeSupSWLPivotsWidth;
int peakResSWHPivotsWidth;
int trendLineBullishWidth;
int trendLineBearishWidth;
int trendBullishPivotsWidth;
int trendBearishPivotsWidth;
int rsiCrossedOverOSPivotsWidth;
int rsiCrossedUnderOBPivotsWidth;
int cciCrossedOverOSPivotsWidth;
int cciCrossedUnderOBPivotsWidth;
//
// Style ...
//
ENUM_LINE_STYLE defaultBullishStyle;
ENUM_LINE_STYLE defaultBearishStyle;
//
ENUM_LINE_STYLE tickPivotsStyle;
ENUM_LINE_STYLE volumePivotsStyle;
ENUM_LINE_STYLE rsiPeakPivotsStyle;
ENUM_LINE_STYLE rsiValePivotsStyle;
ENUM_LINE_STYLE cciPeakPivotsStyle;
ENUM_LINE_STYLE cciValePivotsStyle;
ENUM_LINE_STYLE fvgBullishPivotsStyle;
ENUM_LINE_STYLE fvgBearishPivotsStyle;
ENUM_LINE_STYLE valeSupSWLPivotsStyle;
ENUM_LINE_STYLE peakResSWHPivotsStyle;
ENUM_LINE_STYLE trendLineBullishStyle;
ENUM_LINE_STYLE trendLineBearishStyle;
ENUM_LINE_STYLE trendBullishPivotsStyle;
ENUM_LINE_STYLE trendBearishPivotsStyle;
ENUM_LINE_STYLE rsiCrossedOverOSPivotsStyle;
ENUM_LINE_STYLE rsiCrossedUnderOBPivotsStyle;
ENUM_LINE_STYLE cciCrossedOverOSPivotsStyle;
ENUM_LINE_STYLE cciCrossedUnderOBPivotsStyle;
//
// Colorize Props ...
//
// Width Props ...
//
// Style Props ...
//
// Constructors ...
XCXCAEAPOIDrawer(
XCXCAEAPOIDetector *_detector //
)
{
//
detector = _detector;
drawer = new XCPOIDrawer();
//
Default();
}
//
// De Constructors ...
~XCXCAEAPOIDrawer()
{
//
Clear();
//
ZeroMemory(drawer);
ZeroMemory(detector);
}
//
// Properties ...
//
// Tools ...
//
virtual void Default()
{
//
ignoreUpdateOSCTos = true;
drawTrendPivotsOnlySelectedFVG = true;
//
drawTrendLine = false;
drawTickPivots = false;
drawVolumePivots = false;
drawRSIPeakPivots = false;
drawRSIValePivots = false;
drawCCIPeakPivots = false;
drawCCIValePivots = false;
drawFVGBullishPivots = false;
drawFVGBearishPivots = false;
drawValeSupSWLPivots = false;
drawPeakResSWHPivots = false;
drawTrendBullishPivots = false;
drawTrendBearishPivots = false;
drawRSICrossedOverOSPivots = false;
drawRSICrossedUnderOBPivots = false;
drawCCICrossedOverOSPivots = false;
drawCCICrossedUnderOBPivots = false;
//
defaultBullishColor = clrLime;
defaultBearishColor = clrRed;
//
tickPivotsColor = defaultBullishColor;
volumePivotsColor = defaultBearishColor;
//
rsiValePivotsColor = defaultBullishColor;
cciValePivotsColor = defaultBullishColor;
fvgBullishPivotsColor = defaultBullishColor;
valeSupSWLPivotsColor = defaultBullishColor;
trendLineBullishColor = defaultBullishColor;
trendBullishPivotsColor = defaultBullishColor;
rsiCrossedOverOSPivotsColor = defaultBullishColor;
cciCrossedOverOSPivotsColor = defaultBullishColor;
//
rsiPeakPivotsColor = defaultBearishColor;
cciPeakPivotsColor = defaultBearishColor;
fvgBearishPivotsColor = defaultBearishColor;
peakResSWHPivotsColor = defaultBearishColor;
trendLineBearishColor = defaultBearishColor;
trendBearishPivotsColor = defaultBearishColor;
rsiCrossedUnderOBPivotsColor = defaultBearishColor;
cciCrossedUnderOBPivotsColor = defaultBearishColor;
//
defaultBullishWidth = 1;
defaultBearishWidth = 1;
//
tickPivotsWidth = defaultBullishWidth;
volumePivotsWidth = defaultBearishWidth;
//
rsiValePivotsWidth = defaultBullishWidth;
cciValePivotsWidth = defaultBullishWidth;
fvgBullishPivotsWidth = defaultBullishWidth;
valeSupSWLPivotsWidth = defaultBullishWidth;
trendLineBullishWidth = defaultBullishWidth;
trendBullishPivotsWidth = defaultBullishWidth;
rsiCrossedOverOSPivotsWidth = defaultBullishWidth;
cciCrossedOverOSPivotsWidth = defaultBullishWidth;
//
rsiPeakPivotsWidth = defaultBearishWidth;
cciPeakPivotsWidth = defaultBearishWidth;
fvgBearishPivotsWidth = defaultBearishWidth;
peakResSWHPivotsWidth = defaultBearishWidth;
trendLineBearishWidth = defaultBearishWidth;
trendBearishPivotsWidth = defaultBearishWidth;
rsiCrossedUnderOBPivotsWidth = defaultBearishWidth;
cciCrossedUnderOBPivotsWidth = defaultBearishWidth;
//
defaultBullishStyle = STYLE_SOLID;
defaultBearishStyle = STYLE_SOLID;
//
tickPivotsStyle = defaultBullishStyle;
volumePivotsStyle = defaultBearishStyle;
//
rsiValePivotsStyle = defaultBullishStyle;
cciValePivotsStyle = defaultBullishStyle;
fvgBullishPivotsStyle = defaultBullishStyle;
valeSupSWLPivotsStyle = defaultBullishStyle;
trendLineBullishStyle = defaultBullishStyle;
trendBullishPivotsStyle = defaultBullishStyle;
rsiCrossedOverOSPivotsStyle = defaultBullishStyle;
cciCrossedOverOSPivotsStyle = defaultBullishStyle;
//
rsiPeakPivotsStyle = defaultBearishStyle;
cciPeakPivotsStyle = defaultBearishStyle;
fvgBearishPivotsStyle = defaultBearishStyle;
peakResSWHPivotsStyle = defaultBearishStyle;
trendLineBearishStyle = defaultBearishStyle;
trendBearishPivotsStyle = defaultBearishStyle;
rsiCrossedUnderOBPivotsStyle = defaultBearishStyle;
cciCrossedUnderOBPivotsStyle = defaultBearishStyle;
}
//
void Draw(datetime to = NULL)
{
//
DrawTrendLine();
DrawTickPivots(to);
DrawVolumePivots(to);
DrawRSIPeakPivots(to);
DrawRSIValePivots(to);
DrawCCIPeakPivots(to);
DrawCCIValePivots(to);
DrawFVGBullishPivots(to);
DrawFVGBearishPivots(to);
DrawValeSupSWLPivots(to);
DrawPeakResSWHPivots(to);
DrawTrendBullishPivots(to);
DrawTrendBearishPivots(to);
DrawRSICrossedOverOSPivots(to);
DrawRSICrossedUnderOBPivots(to);
DrawCCICrossedOverOSPivots(to);
DrawCCICrossedUnderOBPivots(to);
}
//
void DrawBox(
XBoxZone &box,
datetime to = NULL //
)
{
//
bool has = box.IsValid();
if (!has)
{
return;
}
//
// Detect Pivot Type ...
ENUM_XCA_PIVOTS iType = GetPivotType(box);
has = IsValid(iType);
if (!has)
{
return;
}
//
switch (iType)
{
//
case XCA_TICK:
//
DrawTickPivot(
box,
to //
);
break;
//
case XCA_VOLUME:
//
DrawVolumePivot(
box,
to //
);
break;
//
case XCA_FVG_BULL:
//
DrawFVGBullishPivot(
box,
to //
);
break;
//
case XCA_FVG_BEAR:
//
DrawFVGBearishPivot(
box,
to //
);
break;
//
case XCA_RSI_COOS:
//
DrawRSICrossedOverOSPivot(
box,
to //
);
break;
//
case XCA_RSI_CUOB:
//
DrawRSICrossedUnderOBPivot(
box,
to //
);
break;
//
case XCA_RSI_PEAK:
//
DrawRSIPeakPivot(
box,
to //
);
break;
//
case XCA_RSI_VALE:
//
DrawRSIValePivot(
box,
to //
);
break;
//
case XCA_CCI_COOS:
//
DrawCCICrossedOverOSPivot(
box,
to //
);
break;
//
case XCA_CCI_CUOB:
//
DrawCCICrossedUnderOBPivot(
box,
to //
);
break;
//
case XCA_CCI_PEAK:
//
DrawCCIPeakPivot(
box,
to //
);
break;
//
case XCA_CCI_VALE:
//
DrawCCIValePivot(
box,
to //
);
break;
//
case XCA_PEAKSWHRES:
//
DrawPeakResSWHPivot(
box,
to //
);
break;
//
case XCA_VALESWLSUP:
//
DrawValeSupSWLPivot(
box,
to //
);
break;
}
}
//
void DrawBoxes(
XBoxZone &boxes[],
datetime to = NULL //
)
{
//
bool has = HasChild(boxes);
if (!has)
{
return;
}
//
int count = ArraySize(boxes);
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = boxes[i];
//
// Detect Pivot Type ...
DrawBox(
iBox,
to //
);
//
iBox.Clean();
};
//
// Trend Items ...
XCATRENDFVG trendFVGs[];
count = ExtractTrendPivots(
trendFVGs,
boxes //
);
has = IsValidSize(count);
if (!has)
{
return;
}
//
for (int i = 0; i < count; i++)
{
//
XCATRENDFVG iTrendFVG = trendFVGs[i];
//
bool isBullish = iTrendFVG.IsBullish();
if (isBullish)
{
//
DrawTrendBullishPivot(
iTrendFVG,
to //
);
}
else
{
//
DrawTrendBearishPivot(
iTrendFVG,
to //
);
}
//
iTrendFVG.Clean();
}
//
Clean(trendFVGs);
}
//
void Clear()
{
//
mTrendLineObjects.Clear();
mTickPivotObjects.Clear();
mVolumePivotObjects.Clear();
mRSIPeakPivotObjects.Clear();
mRSIValePivotObjects.Clear();
mCCIPeakPivotObjects.Clear();
mCCIValePivotObjects.Clear();
mFVGBullishPivotObjects.Clear();
mFVGBearishPivotObjects.Clear();
mValeSupSWLPivotObjects.Clear();
mPeakResSWHPivotObjects.Clear();
mTrendBullishPivotObjects.Clear();
mTrendBearishPivotObjects.Clear();
mRSICrossedOverOSPivotObjects.Clear();
mRSICrossedUnderOBPivotObjects.Clear();
mCCICrossedOverOSPivotObjects.Clear();
mCCICrossedUnderOBPivotObjects.Clear();
}
//
// Collection Drawers ...
//
void DrawTrendLine()
{
//
if (!drawTrendLine)
{
return;
}
//
mTrendLineObjects.Clear();
//
ENUM_X_DIRECTION trend = X_DIRECTION_NONE;
bool has = detector.MarketTrend(trend);
if (!has)
{
return;
}
//
long chartID = drawer.ChartIdentification();
int subWindow = drawer.SubWindowIdentification();
//
bool hasBullishTrend = IsBullish(trend);
//
double pPrice = hasBullishTrend
? detector.trendPivotP.lower
: detector.trendPivotP.upper;
//
datetime pTime = detector.trendPivotP.from;
//
double cPrice = hasBullishTrend
? detector.trendPivotC.lower
: detector.trendPivotC.upper;
//
datetime cTime = detector.trendPivotC.from;
//
string tlName = ToString(trend) +
"_TL_" +
ToString(pPrice) +
"_" +
ToString(cPrice);
//
int tlWidth = hasBullishTrend
? trendLineBullishWidth
: trendLineBearishWidth;
//
color tlColor = hasBullishTrend
? trendLineBullishColor
: trendLineBearishColor;
//
ENUM_LINE_STYLE tlStyle = hasBullishTrend
? trendLineBullishStyle
: trendLineBearishStyle;
//
CChartObjectTrend *iObj;
iObj = new CChartObjectTrend();
has = iObj.Create(
chartID,
tlName,
subWindow,
pTime,
pPrice,
cTime,
cPrice //
);
if (has)
{
//
// Style Object ...
iObj.Color(tlColor);
iObj.Width(tlWidth);
iObj.Style(tlStyle);
iObj.RayRight(true);
//
// Store Object ...
mTrendLineObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawTickPivots(datetime to = NULL)
{
//
bool has = drawTickPivots;
if (!has)
{
return;
}
//
has = detector.HasTickPivots();
if (!has)
{
return;
}
//
int count = detector.CountTickPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.tickPivots[i];
//
DrawTickPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawVolumePivots(datetime to = NULL)
{
//
bool has = drawVolumePivots;
if (!has)
{
return;
}
//
has = detector.HasVolumePivots();
if (!has)
{
return;
}
//
int count = detector.CountVolumePivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.volumePivots[i];
//
DrawVolumePivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawRSIPeakPivots(datetime to = NULL)
{
//
bool has = drawRSIPeakPivots;
if (!has)
{
return;
}
//
has = detector.HasRSIPeakPivots();
if (!has)
{
return;
}
//
int count = detector.CountRSIPeakPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.rsiPeakPivots[i];
//
DrawRSIPeakPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawRSIValePivots(datetime to = NULL)
{
//
bool has = drawRSIValePivots;
if (!has)
{
return;
}
//
has = detector.HasRSIValePivots();
if (!has)
{
return;
}
//
int count = detector.CountRSIValePivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.rsiValePivots[i];
//
DrawRSIValePivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawCCIPeakPivots(datetime to = NULL)
{
//
bool has = drawCCIPeakPivots;
if (!has)
{
return;
}
//
has = detector.HasCCIPeakPivots();
if (!has)
{
return;
}
//
int count = detector.CountCCIPeakPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.cciPeakPivots[i];
//
DrawCCIPeakPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawCCIValePivots(datetime to = NULL)
{
//
bool has = drawCCIValePivots;
if (!has)
{
return;
}
//
has = detector.HasCCIValePivots();
if (!has)
{
return;
}
//
int count = detector.CountCCIValePivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.cciValePivots[i];
//
DrawCCIValePivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawFVGBullishPivots(datetime to = NULL)
{
//
bool has = drawFVGBullishPivots;
if (!has)
{
return;
}
//
has = detector.HasFVGBullishPivots();
if (!has)
{
return;
}
//
int count = detector.CountFVGBullishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.fvgBullishPivots[i];
//
DrawFVGBullishPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawFVGBearishPivots(datetime to = NULL)
{
//
bool has = drawFVGBearishPivots;
if (!has)
{
return;
}
//
has = detector.HasFVGBearishPivots();
if (!has)
{
return;
}
//
int count = detector.CountFVGBearishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.fvgBearishPivots[i];
//
DrawFVGBearishPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawValeSupSWLPivots(datetime to = NULL)
{
//
bool has = drawValeSupSWLPivots;
if (!has)
{
return;
}
//
has = detector.HasValeSupSWLPivots();
if (!has)
{
return;
}
//
int count = detector.CountValeSupSWLPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.valeSupSWLPivots[i];
//
DrawValeSupSWLPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawPeakResSWHPivots(datetime to = NULL)
{
//
bool has = drawPeakResSWHPivots;
if (!has)
{
return;
}
//
has = detector.HasPeakResSWHPivots();
if (!has)
{
return;
}
//
int count = detector.CountPeakResSWHPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.peakResSWHPivots[i];
//
DrawPeakResSWHPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawTrendBullishPivots(datetime to = NULL)
{
//
bool has = drawTrendBullishPivots;
if (!has)
{
return;
}
//
has = detector.HasTrendBullishPivots();
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
int count = detector.CountTrendBullishPivots();
for (int i = 0; i < count; i++)
{
//
XCATRENDFVG iTrendFVG = detector.trendBullishPivots[i];
//
DrawTrendBullishPivot(
iTrendFVG,
to //
);
//
iTrendFVG.Clean();
}
}
//
void DrawTrendBearishPivots(datetime to = NULL)
{
//
bool has = drawTrendBearishPivots;
if (!has)
{
return;
}
//
has = detector.HasTrendBearishPivots();
if (!has)
{
return;
}
//
int count = detector.CountTrendBearishPivots();
for (int i = 0; i < count; i++)
{
//
XCATRENDFVG iTrendFVG = detector.trendBearishPivots[i];
//
DrawTrendBearishPivot(
iTrendFVG,
to //
);
//
iTrendFVG.Clean();
}
}
//
void DrawRSICrossedOverOSPivots(datetime to = NULL)
{
//
bool has = drawRSICrossedOverOSPivots;
if (!has)
{
return;
}
//
has = detector.HasRSICrossedOverOSPivots();
if (!has)
{
return;
}
//
int count = detector.CountRSICrossedOverOSPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.rsiCrossedOverOSPivots[i];
//
DrawRSICrossedOverOSPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawRSICrossedUnderOBPivots(datetime to = NULL)
{
//
bool has = drawRSICrossedUnderOBPivots;
if (!has)
{
return;
}
//
has = detector.HasRSICrossedUnderOBPivots();
if (!has)
{
return;
}
//
int count = detector.CountRSICrossedUnderOBPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.rsiCrossedUnderOBPivots[i];
//
DrawRSICrossedUnderOBPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawCCICrossedOverOSPivots(datetime to = NULL)
{
//
bool has = drawCCICrossedOverOSPivots;
if (!has)
{
return;
}
//
has = detector.HasCCICrossedOverOSPivots();
if (!has)
{
return;
}
//
int count = detector.CountCCICrossedOverOSPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.cciCrossedOverOSPivots[i];
//
DrawCCICrossedOverOSPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawCCICrossedUnderOBPivots(datetime to = NULL)
{
//
bool has = drawCCICrossedUnderOBPivots;
if (!has)
{
return;
}
//
has = detector.HasCCICrossedUnderOBPivots();
if (!has)
{
return;
}
//
int count = detector.CountCCICrossedUnderOBPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.cciCrossedUnderOBPivots[i];
//
DrawCCICrossedUnderOBPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
// One Item Drawers ...
//
void DrawTickPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawTickPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_TICK);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Pivot ...
iObj.BoxColor(tickPivotsColor);
iObj.BoxWidth(tickPivotsWidth);
iObj.BoxStyle(tickPivotsStyle);
//
// Store Pivot ...
mTickPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawVolumePivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawVolumePivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_VOLUME);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Pivot ...
iObj.BoxColor(volumePivotsColor);
iObj.BoxWidth(volumePivotsWidth);
iObj.BoxStyle(volumePivotsStyle);
//
// Store Pivot ...
mVolumePivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawRSIPeakPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawRSIPeakPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_RSI_PEAK) &&
item.dir == GetDirection(XCA_RSI_PEAK);
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(rsiPeakPivotsColor);
iObj.BoxWidth(rsiPeakPivotsWidth);
iObj.BoxStyle(rsiPeakPivotsStyle);
//
// Store Object ...
mRSIPeakPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawRSIValePivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawRSIValePivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_RSI_VALE) &&
item.dir == GetDirection(XCA_RSI_VALE);
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(rsiValePivotsColor);
iObj.BoxWidth(rsiValePivotsWidth);
iObj.BoxStyle(rsiValePivotsStyle);
//
// Store Object ...
mRSIValePivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawCCIPeakPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawCCIPeakPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_CCI_PEAK) &&
item.dir == GetDirection(XCA_CCI_PEAK);
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(cciPeakPivotsColor);
iObj.BoxWidth(cciPeakPivotsWidth);
iObj.BoxStyle(cciPeakPivotsStyle);
//
// Store Object ...
mCCIPeakPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawCCIValePivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawCCIValePivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_CCI_VALE) &&
item.dir == GetDirection(XCA_CCI_VALE);
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(cciValePivotsColor);
iObj.BoxWidth(cciValePivotsWidth);
iObj.BoxStyle(cciValePivotsStyle);
//
// Store Object ...
mCCIValePivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawFVGBullishPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawFVGBullishPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_FVG_BULL) &&
item.dir == GetDirection(XCA_FVG_BULL);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(fvgBullishPivotsColor);
iObj.BoxWidth(fvgBullishPivotsWidth);
iObj.BoxStyle(fvgBullishPivotsStyle);
//
// Store Object ...
mFVGBullishPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawFVGBearishPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawFVGBearishPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_FVG_BEAR) &&
item.dir == GetDirection(XCA_FVG_BEAR);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(fvgBearishPivotsColor);
iObj.BoxWidth(fvgBearishPivotsWidth);
iObj.BoxStyle(fvgBearishPivotsStyle);
//
// Store Object ...
mFVGBearishPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawValeSupSWLPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawValeSupSWLPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_VALESWLSUP) &&
item.dir == GetDirection(XCA_VALESWLSUP);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(valeSupSWLPivotsColor);
iObj.BoxWidth(valeSupSWLPivotsWidth);
iObj.BoxStyle(valeSupSWLPivotsStyle);
//
// Store Object ...
mValeSupSWLPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawPeakResSWHPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawPeakResSWHPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_PEAKSWHRES) &&
item.dir == GetDirection(XCA_PEAKSWHRES);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(peakResSWHPivotsColor);
iObj.BoxWidth(peakResSWHPivotsWidth);
iObj.BoxStyle(peakResSWHPivotsStyle);
//
// Store Object ...
mPeakResSWHPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawTrendBullishPivot(
XCATRENDFVG &item,
datetime to = NULL //
)
{
//
bool has = drawTrendBullishPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.trend.type == GetBoxType(XCA_TREND_BULL) &&
item.trend.dir == GetDirection(XCA_TREND_BULL);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
// Draw Trend Box ...
//
if (canUpdateTo)
{
item.trend.to = to;
}
//
XCBoxObject *iTrendBoxObj;
has = drawer.DrawBox(
item.trend,
iTrendBoxObj //
);
if (has)
{
//
// Style Object ...
iTrendBoxObj.BoxColor(trendBullishPivotsColor);
iTrendBoxObj.BoxWidth(trendBullishPivotsWidth);
iTrendBoxObj.BoxStyle(trendBullishPivotsStyle);
//
// Store Object ...
mTrendBullishPivotObjects.Add(iTrendBoxObj);
}
//
// Draw ITrendFVG FVGS ...
if (drawTrendPivotsOnlySelectedFVG)
{
//
XBoxZone iBox;
has = item.GetSelectedFVG(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
//
if (has)
{
//
// Style Object ...
iObj.BoxColor(fvgBullishPivotsColor);
iObj.BoxWidth(fvgBullishPivotsWidth);
iObj.BoxStyle(fvgBullishPivotsStyle);
//
// Store Object ...
mTrendBullishPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
else
{
//
// Draw All FVGs ...
has = HasChild(item.fvgs);
if (has)
{
//
int jCount = ArraySize(item.fvgs);
for (int j = 0; j < jCount; j++)
{
//
XBoxZone iBox = item.fvgs[j];
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(fvgBullishPivotsColor);
iObj.BoxWidth(fvgBullishPivotsWidth);
iObj.BoxStyle(fvgBullishPivotsStyle);
//
// Store Object ...
mTrendBullishPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
}
//
ZeroMemory(iTrendBoxObj);
}
//
void DrawTrendBearishPivot(
XCATRENDFVG &item,
datetime to = NULL //
)
{
//
bool has = drawTrendBearishPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.trend.type == GetBoxType(XCA_TREND_BEAR) &&
item.trend.dir == GetDirection(XCA_TREND_BEAR);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
// Draw Trend Box ...
//
if (canUpdateTo)
{
item.trend.to = to;
}
//
XCBoxObject *iTrendBoxObj;
has = drawer.DrawBox(
item.trend,
iTrendBoxObj //
);
if (has)
{
//
// Style Object ...
iTrendBoxObj.BoxColor(trendBearishPivotsColor);
iTrendBoxObj.BoxWidth(trendBearishPivotsWidth);
iTrendBoxObj.BoxStyle(trendBearishPivotsStyle);
//
// Store Object ...
mTrendBearishPivotObjects.Add(iTrendBoxObj);
}
//
// Draw ITrendFVG FVGS ...
if (drawTrendPivotsOnlySelectedFVG)
{
//
XBoxZone iBox;
has = item.GetSelectedFVG(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
//
if (has)
{
//
// Style Object ...
iObj.BoxColor(fvgBearishPivotsColor);
iObj.BoxWidth(fvgBearishPivotsWidth);
iObj.BoxStyle(fvgBearishPivotsStyle);
//
// Store Object ...
mTrendBearishPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
else
{
//
// Draw All FVGs ...
has = HasChild(item.fvgs);
if (has)
{
//
int jCount = ArraySize(item.fvgs);
for (int j = 0; j < jCount; j++)
{
//
XBoxZone iBox = item.fvgs[j];
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(fvgBearishPivotsColor);
iObj.BoxWidth(fvgBearishPivotsWidth);
iObj.BoxStyle(fvgBearishPivotsStyle);
//
// Store Object ...
mTrendBearishPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
}
//
ZeroMemory(iTrendBoxObj);
}
//
void DrawRSICrossedOverOSPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawRSICrossedOverOSPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_RSI_COOS) &&
item.dir == GetDirection(XCA_RSI_COOS);
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(rsiCrossedOverOSPivotsColor);
iObj.BoxWidth(rsiCrossedOverOSPivotsWidth);
iObj.BoxStyle(rsiCrossedOverOSPivotsStyle);
//
// Store Object ...
mRSICrossedOverOSPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawRSICrossedUnderOBPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawRSICrossedUnderOBPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_RSI_CUOB) &&
item.dir == GetDirection(XCA_RSI_CUOB);
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(rsiCrossedUnderOBPivotsColor);
iObj.BoxWidth(rsiCrossedUnderOBPivotsWidth);
iObj.BoxStyle(rsiCrossedUnderOBPivotsStyle);
//
// Store Object ...
mRSICrossedUnderOBPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawCCICrossedOverOSPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawCCICrossedOverOSPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_CCI_COOS) &&
item.dir == GetDirection(XCA_CCI_COOS);
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(cciCrossedOverOSPivotsColor);
iObj.BoxWidth(cciCrossedOverOSPivotsWidth);
iObj.BoxStyle(cciCrossedOverOSPivotsStyle);
//
// Store Object ...
mCCICrossedOverOSPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawCCICrossedUnderOBPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawCCICrossedUnderOBPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_CCI_CUOB) &&
item.dir == GetDirection(XCA_CCI_CUOB);
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(cciCrossedUnderOBPivotsColor);
iObj.BoxWidth(cciCrossedUnderOBPivotsWidth);
iObj.BoxStyle(cciCrossedUnderOBPivotsStyle);
//
// Store Object ...
mCCICrossedUnderOBPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
// Protected ...
protected:
//
// Props ...
//
// Prrivate ...
private:
//
// Props ...
//
XCPOIDrawer *drawer;
XCXCAEAPOIDetector *detector;
//
CArrayObj mTickPivotObjects;
CArrayObj mTrendLineObjects;
CArrayObj mVolumePivotObjects;
CArrayObj mRSIPeakPivotObjects;
CArrayObj mRSIValePivotObjects;
CArrayObj mCCIPeakPivotObjects;
CArrayObj mCCIValePivotObjects;
CArrayObj mFVGBullishPivotObjects;
CArrayObj mFVGBearishPivotObjects;
CArrayObj mValeSupSWLPivotObjects;
CArrayObj mPeakResSWHPivotObjects;
CArrayObj mTrendBullishPivotObjects;
CArrayObj mTrendBearishPivotObjects;
CArrayObj mRSICrossedOverOSPivotObjects;
CArrayObj mRSICrossedUnderOBPivotObjects;
CArrayObj mCCICrossedOverOSPivotObjects;
CArrayObj mCCICrossedUnderOBPivotObjects;
//
};
//