212 lines
4.9 KiB
Plaintext
212 lines
4.9 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Class
|
|
// -------------------------------------------------
|
|
// Name: XCXFIMAPoiDrawer ...
|
|
// Description: XFIMA 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 XFIMA POI Drawer Class"
|
|
#property strict
|
|
|
|
//
|
|
// Imports ...
|
|
#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
|
#include "../Libraries/x-saherelm.xfima.lib.mq5"
|
|
|
|
//
|
|
// Implementation ...
|
|
class XCXFIMAPOIDrawer : public XCPOIDrawer
|
|
{
|
|
//
|
|
public:
|
|
//
|
|
|
|
/**
|
|
* Draw Specified XZigZagMarketStyle on Chart ...
|
|
*
|
|
* @param object: XCZigZagAnalysisObject, pointer reference to Drawn Object ...
|
|
* @param model: XZigZagAnalysis, reference to Model ...
|
|
* @param numberOfPivots: int, required number of pivots for Draw Trends ...
|
|
* @param rayRight: bool, Ray To Right ...
|
|
* @param rayLeft: bool, Ray To Left ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool DrawZigZagMarketAnalysisByPV(
|
|
XCZigZagAnalysisObject *&object,
|
|
XZigZagAnalysis &model,
|
|
bool rayRight = false,
|
|
bool rayLeft = false,
|
|
int numberOfPivots = 2 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Prepare ...
|
|
object = NULL;
|
|
|
|
//
|
|
// Validate ...
|
|
result = model.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
object = new XCZigZagAnalysisObject();
|
|
result = object.CreateByPV(
|
|
ChartIdentification(),
|
|
SubWindowIdentification(),
|
|
model //
|
|
);
|
|
if (result)
|
|
{
|
|
//
|
|
// Apply Style ...
|
|
bool isBullish = model.IsBullish();
|
|
|
|
//
|
|
XPOIStyle style;
|
|
if (isBullish)
|
|
{
|
|
style = defaultBullishStyle;
|
|
}
|
|
else
|
|
{
|
|
style = defaultBearishStyle;
|
|
}
|
|
|
|
//
|
|
ApplyZigZagMarketAnalysisStyle(
|
|
object,
|
|
style,
|
|
true, // Ray Right ...
|
|
false // Ray Left ...
|
|
);
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Draw Specified XZigZagMarketStyle on Chart ...
|
|
*
|
|
* @param object: XCZigZagAnalysisObject, pointer reference to Drawn Object ...
|
|
* @param model: XZigZagAnalysis, reference to Model ...
|
|
* @param numberOfPivots: int, required number of pivots for Draw Trends ...
|
|
* @param rayRight: bool, Ray To Right ...
|
|
* @param rayLeft: bool, Ray To Left ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool DrawZigZagMarketAnalysisByRecent(
|
|
XCZigZagAnalysisObject *&object,
|
|
XZigZagAnalysis &model,
|
|
bool rayRight = false,
|
|
bool rayLeft = false,
|
|
int numberOfPivots = 2 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Prepare ...
|
|
object = NULL;
|
|
|
|
//
|
|
// Validate ...
|
|
result = model.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
object = new XCZigZagAnalysisObject();
|
|
result = object.CreateByRecent(
|
|
ChartIdentification(),
|
|
SubWindowIdentification(),
|
|
model,
|
|
numberOfPivots //
|
|
);
|
|
if (result)
|
|
{
|
|
//
|
|
// Apply Style ...
|
|
bool isBullish = model.IsBullish();
|
|
|
|
//
|
|
XPOIStyle style;
|
|
if (isBullish)
|
|
{
|
|
style = defaultBullishStyle;
|
|
}
|
|
else
|
|
{
|
|
style = defaultBearishStyle;
|
|
}
|
|
|
|
//
|
|
ApplyZigZagMarketAnalysisStyle(
|
|
object,
|
|
style,
|
|
true, // Ray Right ...
|
|
false // Ray Left ...
|
|
);
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Apply Specified Style to Object ...
|
|
*/
|
|
void ApplyZigZagMarketAnalysisStyle(
|
|
XCZigZagAnalysisObject *&object,
|
|
XPOIStyle &style,
|
|
bool rayRight = false,
|
|
bool rayLeft = false //
|
|
)
|
|
{
|
|
//
|
|
bool has = object != NULL;
|
|
if (!has)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
object.UpperColor(style.clr);
|
|
object.LowerColor(style.clr);
|
|
object.UpperWidth(style.width);
|
|
object.UpperRayLeft(rayLeft);
|
|
object.UpperRayRight(rayRight);
|
|
object.LowerWidth(style.width);
|
|
object.UpperStyle(style.style);
|
|
object.LowerStyle(style.style);
|
|
object.LowerRayLeft(rayLeft);
|
|
object.LowerRayRight(rayRight);
|
|
}
|
|
|
|
//
|
|
};
|
|
|
|
// |