Files
MQL5Data/XCAEA/Classes/xcaea.x-poi.drawer.class.mq5
T
2025-04-18 22:37:51 +03:30

1440 lines
28 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 drawTrendBullishPivots;
bool drawTrendBearishPivots;
bool drawTKITRNDBullishPivots;
bool drawTKITRNDBearishPivots;
//
bool drawActiveSWHPivot;
bool drawActiveSWLPivot;
bool drawActivePeakPivot;
bool drawActiveValePivot;
bool drawActiveKIBullishPivot;
bool drawActiveKIBearishPivot;
bool drawActivePeakSWHResPivot;
bool drawActiveValeSWLSupPivot;
bool drawActiveTKIBullishPivot;
bool drawActiveTKIBearishPivot;
bool drawActiveTrendBullishPivot;
bool drawActiveTrendBearishPivot;
bool drawActiveTKITRNDBullishPivot;
bool drawActiveTKITRNDBearishPivot;
//
// 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();
mTKITRNDBullishPivotObjects.Clear();
mTKITRNDBearishPivotObjects.Clear();
//
mActiveSWHPivotObject.Delete();
mActiveSWHPivotObject.Detach();
ZeroMemory(mActiveSWHPivotObject);
//
mActiveSWLPivotObject.Delete();
mActiveSWLPivotObject.Detach();
ZeroMemory(mActiveSWLPivotObject);
//
mActivePeakPivotObject.Delete();
mActivePeakPivotObject.Detach();
ZeroMemory(mActivePeakPivotObject);
//
mActiveValePivotObject.Delete();
mActiveValePivotObject.Detach();
ZeroMemory(mActiveValePivotObject);
//
mActiveKIBullishPivotObject.Delete();
mActiveKIBullishPivotObject.Detach();
ZeroMemory(mActiveKIBullishPivotObject);
//
mActiveKIBearishPivotObject.Delete();
mActiveKIBearishPivotObject.Detach();
ZeroMemory(mActiveKIBearishPivotObject);
//
mActivePeakSWHResPivotObject.Delete();
mActivePeakSWHResPivotObject.Detach();
ZeroMemory(mActivePeakSWHResPivotObject);
//
mActiveValeSWLSupPivotObject.Delete();
mActiveValeSWLSupPivotObject.Detach();
ZeroMemory(mActiveValeSWLSupPivotObject);
//
mActiveTKIBullishPivotObject.Delete();
mActiveTKIBullishPivotObject.Detach();
ZeroMemory(mActiveTKIBullishPivotObject);
//
mActiveTKIBearishPivotObject.Delete();
mActiveTKIBearishPivotObject.Detach();
ZeroMemory(mActiveTKIBearishPivotObject);
//
mActiveTrendBullishPivotObject.Delete();
mActiveTrendBullishPivotObject.Detach();
ZeroMemory(mActiveTrendBullishPivotObject);
//
mActiveTrendBearishPivotObject.Delete();
mActiveTrendBearishPivotObject.Detach();
ZeroMemory(mActiveTrendBearishPivotObject);
//
mActiveTKITRNDBullishPivotObject.Delete();
mActiveTKITRNDBullishPivotObject.Detach();
ZeroMemory(mActiveTKITRNDBullishPivotObject);
//
mActiveTKITRNDBearishPivotObject.Delete();
mActiveTKITRNDBearishPivotObject.Detach();
ZeroMemory(mActiveTKITRNDBearishPivotObject);
//
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;
drawTrendBullishPivots = false;
drawTrendBearishPivots = false;
drawTKITRNDBullishPivots = false;
drawTKITRNDBearishPivots = false;
//
drawActiveSWHPivot = false;
drawActiveSWLPivot = false;
drawActivePeakPivot = false;
drawActiveValePivot = false;
drawActiveKIBullishPivot = false;
drawActiveKIBearishPivot = false;
drawActivePeakSWHResPivot = false;
drawActiveValeSWLSupPivot = false;
drawActiveTKIBullishPivot = false;
drawActiveTKIBearishPivot = false;
drawActiveTrendBullishPivot = false;
drawActiveTrendBearishPivot = false;
drawActiveTKITRNDBullishPivot = false;
drawActiveTKITRNDBearishPivot = false;
}
//
void Draw()
{
//
DrawSWHPivots();
DrawSWLPivots();
DrawPeakPivots();
DrawValePivots();
DrawKIBullishPivots();
DrawKIBearishPivots();
DrawPeakSWHResPivots();
DrawValeSWLSupPivots();
DrawTKIBullishPivots();
DrawTKIBearishPivots();
DrawTrendBullishPivots();
DrawTrendBearishPivots();
DrawTKITRNDBullishPivots();
DrawTKITRNDBearishPivots();
}
//
void DrawActives()
{
//
DrawActiveSWHPivot();
DrawActiveSWLPivot();
DrawActivePeakPivot();
DrawActiveValePivot();
DrawActiveKIBullishPivot();
DrawActiveKIBearishPivot();
DrawActivePeakSWHResPivot();
DrawActiveValeSWLSupPivot();
DrawActiveTKIBullishPivot();
DrawActiveTKIBearishPivot();
DrawActiveTrendBullishPivot();
DrawActiveTrendBearishPivot();
DrawActiveTKITRNDBullishPivot();
DrawActiveTKITRNDBearishPivot();
}
//
//
//
//
void DrawSWHPivots()
{
//
if (!drawSWHPivots)
{
return;
}
//
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;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mSWHPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawSWLPivots()
{
//
if (!drawSWLPivots)
{
return;
}
//
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;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mSWLPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawPeakPivots()
{
//
if (!drawPeakPivots)
{
return;
}
//
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;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mPeakPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawValePivots()
{
//
if (!drawValePivots)
{
return;
}
//
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;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mValePivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawKIBullishPivots()
{
//
if (!drawKIBullishPivots)
{
return;
}
//
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;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mKIBullishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawKIBearishPivots()
{
//
if (!drawKIBearishPivots)
{
return;
}
//
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;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mKIBearishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawPeakSWHResPivots()
{
//
if (!drawPeakSWHResPivots)
{
return;
}
//
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;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mPeakSWHResPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawValeSWLSupPivots()
{
//
if (!drawValeSWLSupPivots)
{
return;
}
//
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;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mValeSWLSupPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawTKIBullishPivots()
{
//
if (!drawTKIBullishPivots)
{
return;
}
//
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;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mTKIBullishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawTKIBearishPivots()
{
//
if (!drawTKIBearishPivots)
{
return;
}
//
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;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mTKIBearishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawTrendBullishPivots()
{
//
if (!drawTrendBullishPivots)
{
return;
}
//
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;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mTrendBullishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawTrendBearishPivots()
{
//
if (!drawTrendBearishPivots)
{
return;
}
//
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;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mTrendBearishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawTKITRNDBullishPivots()
{
//
if (!drawTKITRNDBullishPivots)
{
return;
}
//
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;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mTKITRNDBullishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
void DrawTKITRNDBearishPivots()
{
//
if (!drawTKITRNDBearishPivots)
{
return;
}
//
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;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mTKITRNDBearishPivotObjects.Add(iObj);
}
//
iBox.Clean();
}
}
//
//
//
//
void DrawActiveSWHPivot()
{
//
if (!drawActiveSWHPivot)
{
return;
}
//
bool has = detector.swhPivot.IsValid();
if (!has)
{
return;
}
//
XBoxZone iBox;
has = detector.swhPivot.AsBox(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
has = drawer.DrawBox(
iBox,
mActiveSWHPivotObject //
);
//
iBox.Clean();
}
//
void DrawActiveSWLPivot()
{
//
if (!drawActiveSWLPivot)
{
return;
}
//
bool has = detector.swlPivot.IsValid();
if (!has)
{
return;
}
//
XBoxZone iBox;
has = detector.swlPivot.AsBox(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
has = drawer.DrawBox(
iBox,
mActiveSWLPivotObject //
);
//
iBox.Clean();
}
//
void DrawActivePeakPivot()
{
//
if (!drawActivePeakPivot)
{
return;
}
//
bool has = detector.peakPivot.IsValid();
if (!has)
{
return;
}
//
XBoxZone iBox;
has = detector.peakPivot.AsBox(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
has = drawer.DrawBox(
iBox,
mActivePeakPivotObject //
);
//
iBox.Clean();
}
//
void DrawActiveValePivot()
{
//
if (!drawActiveValePivot)
{
return;
}
//
bool has = detector.valePivot.IsValid();
if (!has)
{
return;
}
//
XBoxZone iBox;
has = detector.valePivot.AsBox(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
has = drawer.DrawBox(
iBox,
mActiveValePivotObject //
);
//
iBox.Clean();
}
//
void DrawActiveKIBullishPivot()
{
//
if (!drawActiveKIBullishPivot)
{
return;
}
//
bool has = detector.kiBullishPivot.IsValid();
if (!has)
{
return;
}
//
XBoxZone iBox;
has = detector.kiBullishPivot.AsBox(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
has = drawer.DrawBox(
iBox,
mActiveKIBullishPivotObject //
);
//
iBox.Clean();
}
//
void DrawActiveKIBearishPivot()
{
//
if (!drawActiveKIBearishPivot)
{
return;
}
//
bool has = detector.kiBearishPivot.IsValid();
if (!has)
{
return;
}
//
XBoxZone iBox;
has = detector.kiBearishPivot.AsBox(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
has = drawer.DrawBox(
iBox,
mActiveKIBearishPivotObject //
);
//
iBox.Clean();
}
//
void DrawActivePeakSWHResPivot()
{
//
if (!drawActivePeakSWHResPivot)
{
return;
}
//
bool has = detector.peakSWHResPivot.IsValid();
if (!has)
{
return;
}
//
XBoxZone iBox;
has = detector.peakSWHResPivot.AsBox(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
has = drawer.DrawBox(
iBox,
mActivePeakSWHResPivotObject //
);
//
iBox.Clean();
}
//
void DrawActiveValeSWLSupPivot()
{
//
if (!drawActiveValeSWLSupPivot)
{
return;
}
//
bool has = detector.valeSWLSupPivot.IsValid();
if (!has)
{
return;
}
//
XBoxZone iBox;
has = detector.valeSWLSupPivot.AsBox(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
has = drawer.DrawBox(
iBox,
mActiveValeSWLSupPivotObject //
);
//
iBox.Clean();
}
//
void DrawActiveTKIBullishPivot()
{
//
if (!drawActiveTKIBullishPivot)
{
return;
}
//
bool has = detector.tkiBullishPivot.IsValid();
if (!has)
{
return;
}
//
XBoxZone iBox;
has = detector.tkiBullishPivot.AsBox(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
has = drawer.DrawBox(
iBox,
mActiveTKIBullishPivotObject //
);
//
iBox.Clean();
}
//
void DrawActiveTKIBearishPivot()
{
//
if (!drawActiveTKIBearishPivot)
{
return;
}
//
bool has = detector.tkiBearishPivot.IsValid();
if (!has)
{
return;
}
//
XBoxZone iBox;
has = detector.tkiBearishPivot.AsBox(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
has = drawer.DrawBox(
iBox,
mActiveTKIBearishPivotObject //
);
//
iBox.Clean();
}
//
void DrawActiveTrendBullishPivot()
{
//
if (!drawActiveTrendBullishPivot)
{
return;
}
//
bool has = detector.trendBullishPivot.IsValid();
if (!has)
{
return;
}
//
XBoxZone iBox;
has = detector.trendBullishPivot.AsBox(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
has = drawer.DrawBox(
iBox,
mActiveTrendBullishPivotObject //
);
//
iBox.Clean();
}
//
void DrawActiveTrendBearishPivot()
{
//
if (!drawActiveTrendBearishPivot)
{
return;
}
//
bool has = detector.trendBearishPivot.IsValid();
if (!has)
{
return;
}
//
XBoxZone iBox;
has = detector.trendBearishPivot.AsBox(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
has = drawer.DrawBox(
iBox,
mActiveTrendBearishPivotObject //
);
//
iBox.Clean();
}
//
void DrawActiveTKITRNDBullishPivot()
{
//
if (!drawActiveTKITRNDBullishPivot)
{
return;
}
//
bool has = detector.tkitrndBullishPivot.IsValid();
if (!has)
{
return;
}
//
XBoxZone iBox;
has = detector.tkitrndBullishPivot.AsBox(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
has = drawer.DrawBox(
iBox,
mActiveTKITRNDBullishPivotObject //
);
//
iBox.Clean();
}
//
void DrawActiveTKITRNDBearishPivot()
{
//
if (!drawActiveTKITRNDBearishPivot)
{
return;
}
//
bool has = detector.tkitrndBearishPivot.IsValid();
if (!has)
{
return;
}
//
XBoxZone iBox;
has = detector.tkitrndBearishPivot.AsBox(iBox);
if (!has)
{
//
iBox.Clean();
return;
}
//
has = drawer.DrawBox(
iBox,
mActiveTKITRNDBearishPivotObject //
);
//
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 mTrendBullishPivotObjects;
CArrayObj mTrendBearishPivotObjects;
CArrayObj mTKITRNDBullishPivotObjects;
CArrayObj mTKITRNDBearishPivotObjects;
//
XCBoxObject *mActiveSWHPivotObject;
XCBoxObject *mActiveSWLPivotObject;
XCBoxObject *mActivePeakPivotObject;
XCBoxObject *mActiveValePivotObject;
XCBoxObject *mActiveKIBullishPivotObject;
XCBoxObject *mActiveKIBearishPivotObject;
XCBoxObject *mActivePeakSWHResPivotObject;
XCBoxObject *mActiveValeSWLSupPivotObject;
XCBoxObject *mActiveTKIBullishPivotObject;
XCBoxObject *mActiveTKIBearishPivotObject;
XCBoxObject *mActiveTrendBullishPivotObject;
XCBoxObject *mActiveTrendBearishPivotObject;
XCBoxObject *mActiveTKITRNDBullishPivotObject;
XCBoxObject *mActiveTKITRNDBearishPivotObject;
//
};
//