Files
MQL5Data/XCAEA/Classes/xcaea.x-poi.drawer.class.mq5
T

909 lines
20 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;
//
// Drawers ...
bool drawRSIPeakPivots;
bool drawRSIValePivots;
bool drawCCIPeakPivots;
bool drawCCIValePivots;
bool drawFVGBullishPivots;
bool drawFVGBearishPivots;
bool drawValeSupSWLPivots;
bool drawPeakResSWHPivots;
bool drawPVFVGBullishPivots;
bool drawPVFVGBearishPivots;
//
// Colors ...
//
color defaultBullishColor;
color defaultBearishColor;
//
color rsiPeakPivotsColor;
color rsiValePivotsColor;
color cciPeakPivotsColor;
color cciValePivotsColor;
color fvgBullishPivotsColor;
color fvgBearishPivotsColor;
color valeSupSWLPivotsColor;
color peakResSWHPivotsColor;
color pvFVGBullishPivotsColor;
color pvFVGBearishPivotsColor;
//
// Width ...
//
int defaultBullishWidth;
int defaultBearishWidth;
//
int rsiPeakPivotsWidth;
int rsiValePivotsWidth;
int cciPeakPivotsWidth;
int cciValePivotsWidth;
int fvgBullishPivotsWidth;
int fvgBearishPivotsWidth;
int valeSupSWLPivotsWidth;
int peakResSWHPivotsWidth;
int pvFVGBullishPivotsWidth;
int pvFVGBearishPivotsWidth;
//
// Style ...
//
ENUM_LINE_STYLE defaultBullishStyle;
ENUM_LINE_STYLE defaultBearishStyle;
//
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 pvFVGBullishPivotsStyle;
ENUM_LINE_STYLE pvFVGBearishPivotsStyle;
//
// 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;
//
drawRSIPeakPivots = false;
drawRSIValePivots = false;
drawCCIPeakPivots = false;
drawCCIValePivots = false;
drawFVGBullishPivots = false;
drawFVGBearishPivots = false;
drawValeSupSWLPivots = false;
drawPeakResSWHPivots = false;
drawPVFVGBullishPivots = false;
drawPVFVGBearishPivots = false;
//
defaultBullishColor = clrLime;
defaultBearishColor = clrRed;
//
rsiValePivotsColor = defaultBullishColor;
cciValePivotsColor = defaultBullishColor;
fvgBullishPivotsColor = defaultBullishColor;
valeSupSWLPivotsColor = defaultBullishColor;
pvFVGBullishPivotsColor = defaultBullishColor;
//
rsiPeakPivotsColor = defaultBearishColor;
cciPeakPivotsColor = defaultBearishColor;
fvgBearishPivotsColor = defaultBearishColor;
peakResSWHPivotsColor = defaultBearishColor;
pvFVGBearishPivotsColor = defaultBearishColor;
//
defaultBullishWidth = 1;
defaultBearishWidth = 1;
//
rsiValePivotsWidth = defaultBullishWidth;
cciValePivotsWidth = defaultBullishWidth;
fvgBullishPivotsWidth = defaultBullishWidth;
valeSupSWLPivotsWidth = defaultBullishWidth;
pvFVGBullishPivotsWidth = defaultBullishWidth;
//
rsiPeakPivotsWidth = defaultBearishWidth;
cciPeakPivotsWidth = defaultBearishWidth;
fvgBearishPivotsWidth = defaultBearishWidth;
peakResSWHPivotsWidth = defaultBearishWidth;
pvFVGBearishPivotsWidth = defaultBearishWidth;
//
defaultBullishStyle = STYLE_SOLID;
defaultBearishStyle = STYLE_SOLID;
//
rsiValePivotsStyle = defaultBullishStyle;
cciValePivotsStyle = defaultBullishStyle;
fvgBullishPivotsStyle = defaultBullishStyle;
valeSupSWLPivotsStyle = defaultBullishStyle;
pvFVGBullishPivotsStyle = defaultBullishStyle;
//
rsiPeakPivotsStyle = defaultBearishStyle;
cciPeakPivotsStyle = defaultBearishStyle;
fvgBearishPivotsStyle = defaultBearishStyle;
peakResSWHPivotsStyle = defaultBearishStyle;
pvFVGBearishPivotsStyle = defaultBearishStyle;
}
//
void Draw(datetime to = NULL)
{
//
DrawRSIPeakPivots(to);
DrawRSIValePivots(to);
DrawCCIPeakPivots(to);
DrawCCIValePivots(to);
DrawFVGBullishPivots(to);
DrawFVGBearishPivots(to);
DrawValeSupSWLPivots(to);
DrawPeakResSWHPivots(to);
DrawPVFVGBullishPivots(to);
DrawPVFVGBearishPivots(to);
}
//
void Clear()
{
//
mRSIPeakPivotObjects.Clear();
mRSIValePivotObjects.Clear();
mCCIPeakPivotObjects.Clear();
mCCIValePivotObjects.Clear();
mFVGBullishPivotObjects.Clear();
mFVGBearishPivotObjects.Clear();
mValeSupSWLPivotObjects.Clear();
mPeakResSWHPivotObjects.Clear();
mPVFVGBullishPivotObjects.Clear();
mPVFVGBearishPivotObjects.Clear();
}
//
//
//
//
void DrawRSIPeakPivots(datetime to = NULL)
{
//
bool has = drawRSIPeakPivots;
if (!has)
{
return;
}
//
has = detector.HasRSIPeakPivots();
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
bool canUpdateTo = IsValid(to);
//
int count = detector.CountRSIPeakPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.rsiPeakPivots[i];
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(rsiPeakPivotsColor);
iObj.BoxWidth(rsiPeakPivotsWidth);
iObj.BoxStyle(rsiPeakPivotsStyle);
//
// Store Object ...
mRSIPeakPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
//
void DrawRSIValePivots(datetime to = NULL)
{
//
bool has = drawRSIValePivots;
if (!has)
{
return;
}
//
has = detector.HasRSIValePivots();
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
bool canUpdateTo = IsValid(to);
//
int count = detector.CountRSIValePivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.rsiValePivots[i];
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(rsiValePivotsColor);
iObj.BoxWidth(rsiValePivotsWidth);
iObj.BoxStyle(rsiValePivotsStyle);
//
// Store Object ...
mRSIValePivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
//
void DrawCCIPeakPivots(datetime to = NULL)
{
//
bool has = drawCCIPeakPivots;
if (!has)
{
return;
}
//
has = detector.HasCCIPeakPivots();
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
bool canUpdateTo = IsValid(to);
//
int count = detector.CountCCIPeakPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.cciPeakPivots[i];
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(cciPeakPivotsColor);
iObj.BoxWidth(cciPeakPivotsWidth);
iObj.BoxStyle(cciPeakPivotsStyle);
//
// Store Object ...
mCCIPeakPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
//
void DrawCCIValePivots(datetime to = NULL)
{
//
bool has = drawCCIValePivots;
if (!has)
{
return;
}
//
has = detector.HasCCIValePivots();
if (!has)
{
return;
}
//
if (ignoreUpdateOSCTos)
{
to = NULL;
}
bool canUpdateTo = IsValid(to);
//
int count = detector.CountCCIValePivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.cciValePivots[i];
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(cciValePivotsColor);
iObj.BoxWidth(cciValePivotsWidth);
iObj.BoxStyle(cciValePivotsStyle);
//
// Store Object ...
mCCIValePivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
//
void DrawFVGBullishPivots(datetime to = NULL)
{
//
bool has = drawFVGBullishPivots;
if (!has)
{
return;
}
//
has = detector.HasFVGBullishPivots();
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
int count = detector.CountFVGBullishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.fvgBullishPivots[i];
//
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 ...
mFVGBullishPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
//
void DrawFVGBearishPivots(datetime to = NULL)
{
//
bool has = drawFVGBearishPivots;
if (!has)
{
return;
}
//
has = detector.HasFVGBearishPivots();
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
int count = detector.CountFVGBearishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.fvgBearishPivots[i];
//
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 ...
mFVGBearishPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
//
void DrawValeSupSWLPivots(datetime to = NULL)
{
//
bool has = drawValeSupSWLPivots;
if (!has)
{
return;
}
//
has = detector.HasValeSupSWLPivots();
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
int count = detector.CountValeSupSWLPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.valeSupSWLPivots[i];
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(valeSupSWLPivotsColor);
iObj.BoxWidth(valeSupSWLPivotsWidth);
iObj.BoxStyle(valeSupSWLPivotsStyle);
//
// Store Object ...
mValeSupSWLPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
//
void DrawPeakResSWHPivots(datetime to = NULL)
{
//
bool has = drawPeakResSWHPivots;
if (!has)
{
return;
}
//
has = detector.HasPeakResSWHPivots();
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
int count = detector.CountPeakResSWHPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.peakResSWHPivots[i];
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
//
// Style Object ...
iObj.BoxColor(peakResSWHPivotsColor);
iObj.BoxWidth(peakResSWHPivotsWidth);
iObj.BoxStyle(peakResSWHPivotsStyle);
//
// Store Object ...
mPeakResSWHPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
//
void DrawPVFVGBullishPivots(datetime to = NULL)
{
//
bool has = drawPVFVGBullishPivots;
if (!has)
{
return;
}
//
has = detector.HasPVFVGBullishPivots();
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
int count = detector.CountPVFVGBullishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.pvFVGBullishPivots[i].GetSelectedFVG(iBox);
if (!has)
{
//
iBox.Clean();
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
//
if (has)
{
//
// Style Object ...
iObj.BoxColor(pvFVGBullishPivotsColor);
iObj.BoxWidth(pvFVGBullishPivotsWidth);
iObj.BoxStyle(pvFVGBullishPivotsStyle);
//
// Store Object ...
mPVFVGBullishPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
//
void DrawPVFVGBearishPivots(datetime to = NULL)
{
//
bool has = drawPVFVGBearishPivots;
if (!has)
{
return;
}
//
has = detector.HasPVFVGBearishPivots();
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
int count = detector.CountPVFVGBearishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.pvFVGBearishPivots[i].GetSelectedFVG(iBox);
if (!has)
{
//
iBox.Clean();
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
//
if (has)
{
//
// Style Object ...
iObj.BoxColor(pvFVGBearishPivotsColor);
iObj.BoxWidth(pvFVGBearishPivotsWidth);
iObj.BoxStyle(pvFVGBearishPivotsStyle);
//
// Store Object ...
mPVFVGBearishPivotObjects.Add(iObj);
}
//
iBox.Clean();
ZeroMemory(iObj);
}
}
//
// Protected ...
protected:
//
// Props ...
//
// Prrivate ...
private:
//
// Props ...
//
XCPOIDrawer *drawer;
XCXCAEAPOIDetector *detector;
//
CArrayObj mRSIPeakPivotObjects;
CArrayObj mRSIValePivotObjects;
CArrayObj mCCIPeakPivotObjects;
CArrayObj mCCIValePivotObjects;
CArrayObj mFVGBullishPivotObjects;
CArrayObj mFVGBearishPivotObjects;
CArrayObj mValeSupSWLPivotObjects;
CArrayObj mPeakResSWHPivotObjects;
CArrayObj mPVFVGBullishPivotObjects;
CArrayObj mPVFVGBearishPivotObjects;
//
};
//