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

1274 lines
26 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 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 drawSWHPivots;
bool drawSWLPivots;
bool drawPeakPivots;
bool drawValePivots;
bool drawKIBullishPivots;
bool drawKIBearishPivots;
bool drawPeakSWHResPivots;
bool drawValeSWLSupPivots;
bool drawTKIBullishPivots;
bool drawTKIBearishPivots;
bool drawCycleSameLLPivots;
bool drawCycleSameHHPivots;
bool drawTrendBullishPivots;
bool drawTrendBearishPivots;
bool drawTKITRNDBullishPivots;
bool drawTKITRNDBearishPivots;
//
// Constructors ...
XCXCAEAPOIDrawer(
XCXCAEAPOIDetector *_detector //
)
{
//
detector = _detector;
drawer = new XCPOIDrawer();
//
Default();
}
//
// De Constructors ...
~XCXCAEAPOIDrawer()
{
//
mSWHPivotObjects.Clear();
mSWLPivotObjects.Clear();
mPeakPivotObjects.Clear();
mValePivotObjects.Clear();
mKIBullishPivotObjects.Clear();
mKIBearishPivotObjects.Clear();
mPeakSWHResPivotObjects.Clear();
mValeSWLSupPivotObjects.Clear();
mTKIBullishPivotObjects.Clear();
mTKIBearishPivotObjects.Clear();
mTrendBullishPivotObjects.Clear();
mTrendBearishPivotObjects.Clear();
mCycleSameLLPivotObjects.Clear();
mCycleSameHHPivotObjects.Clear();
mTKITRNDBullishPivotObjects.Clear();
mTKITRNDBearishPivotObjects.Clear();
//
ZeroMemory(drawer);
ZeroMemory(detector);
}
//
// Properties ...
//
// Tools ...
//
virtual void Default()
{
//
drawSWHPivots = false;
drawSWLPivots = false;
drawPeakPivots = false;
drawValePivots = false;
drawKIBullishPivots = false;
drawKIBearishPivots = false;
drawPeakSWHResPivots = false;
drawValeSWLSupPivots = false;
drawTKIBullishPivots = false;
drawTKIBearishPivots = false;
drawCycleSameLLPivots = false;
drawCycleSameHHPivots = false;
drawTrendBullishPivots = false;
drawTrendBearishPivots = false;
drawTKITRNDBullishPivots = false;
drawTKITRNDBearishPivots = false;
}
//
void Draw(datetime to = NULL)
{
//
DrawSWHPivots(to);
DrawSWLPivots(to);
DrawPeakPivots(to);
DrawValePivots(to);
DrawKIBullishPivots(to);
DrawKIBearishPivots(to);
DrawPeakSWHResPivots(to);
DrawValeSWLSupPivots(to);
DrawTKIBullishPivots(to);
DrawTKIBearishPivots(to);
DrawCycleSameLLPivots(to);
DrawCycleSameHHPivots(to);
DrawTrendBullishPivots(to);
DrawTrendBearishPivots(to);
DrawTKITRNDBullishPivots(to);
DrawTKITRNDBearishPivots(to);
}
//
//
//
//
void DrawSWHPivots(datetime to = NULL)
{
//
if (!drawSWHPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
bool has = detector.HasSWHPivots();
if (!has)
{
return;
}
//
int count = detector.CountSWHPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.swhPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mSWHPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawSWLPivots(datetime to = NULL)
{
//
if (!drawSWLPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
bool has = detector.HasSWLPivots();
if (!has)
{
return;
}
//
int count = detector.CountSWLPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.swlPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mSWLPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawPeakPivots(datetime to = NULL)
{
//
if (!drawPeakPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
bool has = detector.HasPeakPivots();
if (!has)
{
return;
}
//
int count = detector.CountPeakPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.peakPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mPeakPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawValePivots(datetime to = NULL)
{
//
if (!drawValePivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
bool has = detector.HasValePivots();
if (!has)
{
return;
}
//
int count = detector.CountValePivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.valePivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mValePivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawKIBullishPivots(datetime to = NULL)
{
//
if (!drawKIBullishPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
bool has = detector.HasKIBullishPivots();
if (!has)
{
return;
}
//
int count = detector.CountKIBullishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.kiBullishPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mKIBullishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawKIBearishPivots(datetime to = NULL)
{
//
if (!drawKIBearishPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
bool has = detector.HasKIBearishPivots();
if (!has)
{
return;
}
//
int count = detector.CountKIBearishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.kiBearishPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mKIBearishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawPeakSWHResPivots(datetime to = NULL)
{
//
if (!drawPeakSWHResPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
bool has = detector.HasPeakSWHResPivots();
if (!has)
{
return;
}
//
int count = detector.CountPeakSWHResPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.peakSWHResPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mPeakSWHResPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawValeSWLSupPivots(datetime to = NULL)
{
//
if (!drawValeSWLSupPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
bool has = detector.HasValeSWLSupPivots();
if (!has)
{
return;
}
//
int count = detector.CountValeSWLSupPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.valeSWLSupPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mValeSWLSupPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawTKIBullishPivots(datetime to = NULL)
{
//
if (!drawTKIBullishPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
bool has = detector.HasTKIBullishPivots();
if (!has)
{
return;
}
//
int count = detector.CountTKIBullishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.tkiBullishPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mTKIBullishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawTKIBearishPivots(datetime to = NULL)
{
//
if (!drawTKIBearishPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
bool has = detector.HasTKIBearishPivots();
if (!has)
{
return;
}
//
int count = detector.CountTKIBearishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.tkiBearishPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mTKIBearishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawTrendBullishPivots(datetime to = NULL)
{
//
if (!drawTrendBullishPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
bool has = detector.HasTrendBullishPivots();
if (!has)
{
return;
}
//
int count = detector.CountTrendBullishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.trendBullishPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mTrendBullishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawTrendBearishPivots(datetime to = NULL)
{
//
if (!drawTrendBearishPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
bool has = detector.HasTrendBearishPivots();
if (!has)
{
return;
}
//
int count = detector.CountTrendBearishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.trendBearishPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mTrendBearishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawTKITRNDBullishPivots(datetime to = NULL)
{
//
if (!drawTKITRNDBullishPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
bool has = detector.HasTKITRNDBullishPivots();
if (!has)
{
return;
}
//
int count = detector.CountTKITRNDBullishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.tkitrndBullishPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mTKITRNDBullishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawTKITRNDBearishPivots(datetime to = NULL)
{
//
if (!drawTKITRNDBearishPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
bool has = detector.HasTKITRNDBearishPivots();
if (!has)
{
return;
}
//
int count = detector.CountTKITRNDBearishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.tkitrndBearishPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mTKITRNDBearishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawCycleSameLLPivots(datetime to = NULL)
{
//
if (!drawCycleSameLLPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
int count = 0;
//
// SHORT ...
bool has = detector.HasSSameLLPivots();
if (has)
{
//
count = detector.CountSSameLLPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.sSameLLPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mCycleSameLLPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
// MEDIUM ...
has = detector.HasMSameLLPivots();
if (has)
{
//
count = detector.CountMSameLLPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.mSameLLPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mCycleSameLLPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
// LONG ...
has = detector.HasLSameLLPivots();
if (has)
{
//
count = detector.CountLSameLLPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.lSameLLPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mCycleSameLLPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
// HIND ...
has = detector.HasHSameLLPivots();
if (has)
{
//
count = detector.CountHSameLLPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.hSameLLPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mCycleSameLLPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
}
//
void DrawCycleSameHHPivots(datetime to = NULL)
{
//
if (!drawCycleSameHHPivots)
{
return;
}
//
bool canUpdateTo = IsValid(to);
//
int count = 0;
//
// SHORT ...
bool has = detector.HasSSameHHPivots();
if (has)
{
//
count = detector.CountSSameHHPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.sSameHHPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mCycleSameHHPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
// MEDIUM ...
has = detector.HasMSameHHPivots();
if (has)
{
//
count = detector.CountMSameHHPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.mSameHHPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mCycleSameHHPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
// LONG ...
has = detector.HasLSameHHPivots();
if (has)
{
//
count = detector.CountLSameHHPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.lSameHHPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mCycleSameHHPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
// HIND ...
has = detector.HasHSameHHPivots();
if (has)
{
//
count = detector.CountHSameHHPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector.hSameHHPivots[i].AsBox(iBox);
if (!has)
{
continue;
}
//
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mCycleSameHHPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
}
//
// Protected ...
protected:
//
// Props ...
//
// Prrivate ...
private:
//
// Props ...
//
XCPOIDrawer *drawer;
XCXCAEAPOIDetector *detector;
//
CArrayObj mSWHPivotObjects;
CArrayObj mSWLPivotObjects;
CArrayObj mPeakPivotObjects;
CArrayObj mValePivotObjects;
CArrayObj mKIBullishPivotObjects;
CArrayObj mKIBearishPivotObjects;
CArrayObj mPeakSWHResPivotObjects;
CArrayObj mValeSWLSupPivotObjects;
CArrayObj mTKIBullishPivotObjects;
CArrayObj mTKIBearishPivotObjects;
CArrayObj mCycleSameLLPivotObjects;
CArrayObj mCycleSameHHPivotObjects;
CArrayObj mTrendBullishPivotObjects;
CArrayObj mTrendBearishPivotObjects;
CArrayObj mTKITRNDBullishPivotObjects;
CArrayObj mTKITRNDBearishPivotObjects;
//
};
//