191 lines
3.8 KiB
Plaintext
191 lines
3.8 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Class
|
|
// -------------------------------------------------
|
|
// Name: XCXOM1POIDrawer ...
|
|
// Description: XOM1EA POI Drawer Class ...
|
|
//
|
|
//
|
|
// 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 XOM1EA POI Drawer Class"
|
|
#property strict
|
|
|
|
//
|
|
// Imports ...
|
|
#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
|
#include "../Libraries/xom1ea.lib.mq5"
|
|
|
|
//
|
|
// Definitions ...
|
|
|
|
//
|
|
// Implementation ...
|
|
class XCXOM1POIDrawer : public XCBase
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
// Constructor ...
|
|
XCXOM1POIDrawer()
|
|
{
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
~XCXOM1POIDrawer()
|
|
{
|
|
mObjects.Clear();
|
|
}
|
|
|
|
//
|
|
// Actions ...
|
|
|
|
/**
|
|
* Draw Specified Zone ...
|
|
*
|
|
* @param zone: XOM1Zone
|
|
* @param drawPrice: bool
|
|
* @param drawMiddle: bool
|
|
*/
|
|
void DrawZone(
|
|
XOM1Zone &zone,
|
|
bool drawPrice = false,
|
|
bool drawMiddle = false //
|
|
)
|
|
{
|
|
//
|
|
bool has = false;
|
|
|
|
//
|
|
// Validate ...
|
|
has = zone.IsValid();
|
|
if (!has)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
// Converts to Box ...
|
|
XBoxZone box;
|
|
has = zone.ToBox(box);
|
|
if (!has)
|
|
{
|
|
//
|
|
box.Clean();
|
|
return;
|
|
}
|
|
|
|
//
|
|
// Draw Box ...
|
|
XCBoxObject *object;
|
|
has = mDrawer.DrawBox(
|
|
box,
|
|
object,
|
|
true // Ignore At ...
|
|
);
|
|
if (has)
|
|
{
|
|
mObjects.Add(object);
|
|
}
|
|
|
|
//
|
|
// Draw Price ...
|
|
if (drawPrice)
|
|
{
|
|
//
|
|
CChartObjectTrend *mLineObj;
|
|
string mLineName = "pl_" + ToMD5(zone.GetTag());
|
|
mLineObj = new CChartObjectTrend();
|
|
has = mLineObj.Create(
|
|
mDrawer.ChartIdentification(),
|
|
mLineName,
|
|
mDrawer.SubWindowIdentification(),
|
|
zone.from,
|
|
zone.price,
|
|
zone.to,
|
|
zone.price //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
mDrawer.ApplyStyle(
|
|
mLineObj,
|
|
zone.dir //
|
|
);
|
|
|
|
//
|
|
mObjects.Add(mLineObj);
|
|
}
|
|
}
|
|
|
|
//
|
|
// Draw Middle ...
|
|
if (drawMiddle)
|
|
{
|
|
//
|
|
CChartObjectTrend *mLineObj;
|
|
double mlPrice = zone.lower + ((zone.upper - zone.lower) / 2);
|
|
string mLineName = "ml_" + ToMD5(zone.GetTag());
|
|
mLineObj = new CChartObjectTrend();
|
|
has = mLineObj.Create(
|
|
mDrawer.ChartIdentification(),
|
|
mLineName,
|
|
mDrawer.SubWindowIdentification(),
|
|
zone.from,
|
|
mlPrice,
|
|
zone.to,
|
|
mlPrice //
|
|
);
|
|
if (has)
|
|
{
|
|
//
|
|
mDrawer.ApplyStyle(
|
|
mLineObj,
|
|
zone.dir //
|
|
);
|
|
|
|
//
|
|
mObjects.Add(mLineObj);
|
|
}
|
|
}
|
|
|
|
//
|
|
// Clean Resources ...
|
|
box.Clean();
|
|
}
|
|
|
|
/**
|
|
* Clear Drawn Objects ...
|
|
*/
|
|
void Clear()
|
|
{
|
|
mObjects.Clear();
|
|
}
|
|
|
|
//
|
|
// Protected ...
|
|
protected:
|
|
//
|
|
// Private ...
|
|
private:
|
|
//
|
|
// Props ...
|
|
CArrayObj mObjects; // Drawn Objects ...
|
|
XCPOIDrawer mDrawer; // Base POI Drawer ...
|
|
};
|
|
|
|
// |