130 lines
2.9 KiB
Plaintext
130 lines
2.9 KiB
Plaintext
//+------------------------------------------------------------------+
|
|
//| x-saherelm.xpoi.test.ea.mq5 |
|
|
//| SaherElm IT Center |
|
|
//| https://www.saherelm.ir |
|
|
//+------------------------------------------------------------------+
|
|
#property copyright "SaherElm IT Center"
|
|
#property link "https://www.saherelm.ir"
|
|
#property version "1.00"
|
|
|
|
//
|
|
// #include "../Classes/x-saherelm.x-poi.class.mq5"
|
|
// #include "../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
|
// #include "../Libraries/x-saherelm.x-poi.extensions.lib.mq5"
|
|
// #include "../Libraries/x-saherelm.x-poi.state.lib.mq5"
|
|
|
|
//
|
|
#include "../Classes/x-saherelm.x-bar.analyser.class.mq5"
|
|
|
|
//
|
|
// Global Variables ...
|
|
|
|
//
|
|
// XCPOIDrawer *mPOIDrawer;
|
|
|
|
//
|
|
// XCPOIDetector *mPOIDetector;
|
|
XCBarAnalyser *mBarAnalyser;
|
|
|
|
//
|
|
bool useDetector = false;
|
|
bool useBarAnalyser = true;
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Expert initialization function |
|
|
//+------------------------------------------------------------------+
|
|
int OnInit()
|
|
{
|
|
//
|
|
// mPOIDetector = new XCPOIDetector(
|
|
// _Symbol,
|
|
// _Period //
|
|
// );
|
|
|
|
//
|
|
// mPOIDrawer = new XCPOIDrawer();
|
|
|
|
//
|
|
mBarAnalyser = new XCBarAnalyser();
|
|
|
|
//
|
|
return (INIT_SUCCEEDED);
|
|
}
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Expert deinitialization function |
|
|
//+------------------------------------------------------------------+
|
|
void OnDeinit(const int reason)
|
|
{
|
|
//
|
|
// ZeroMemory(mPOIDrawer);
|
|
// ZeroMemory(mPOIDetector);
|
|
ZeroMemory(mBarAnalyser);
|
|
}
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Expert tick function |
|
|
//+------------------------------------------------------------------+
|
|
void OnTick()
|
|
{
|
|
//
|
|
DetectBarAnalyser();
|
|
|
|
//
|
|
DetectPOIState();
|
|
}
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Custom Functions |
|
|
//+------------------------------------------------------------------+
|
|
|
|
/**
|
|
* Detect POI(s) Using Bar Analyser Class ...
|
|
*/
|
|
void DetectBarAnalyser()
|
|
{
|
|
//
|
|
if (!useBarAnalyser)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
XOHCL zBar;
|
|
bool isInited = zBar.Init(
|
|
_Symbol,
|
|
_Period,
|
|
0 //
|
|
);
|
|
|
|
//
|
|
XOHCL toBar;
|
|
XOHCL fromBar;
|
|
ENUM_X_DIRECTION dir;
|
|
bool isSpike = mBarAnalyser.IsSpike(
|
|
zBar,
|
|
fromBar,
|
|
toBar,
|
|
dir //
|
|
);
|
|
if (isSpike)
|
|
{
|
|
Print("Spike Detected ...");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Detect POI(s) Using POIDetector Class ...
|
|
*/
|
|
void DetectPOIState()
|
|
{
|
|
//
|
|
if (!useDetector)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
//
|
|
//+------------------------------------------------------------------+
|