last ...
This commit is contained in:
@@ -0,0 +1,208 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| Test.mq5 |
|
||||
//| Copyright 2025, MetaQuotes Ltd. |
|
||||
//| https://www.mql5.com |
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Copyright 2025, MetaQuotes Ltd."
|
||||
#property link "https://www.mql5.com"
|
||||
#property version "1.00"
|
||||
|
||||
//
|
||||
#include "../Classes/x-saherelm.x-bar.analyser.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-poi.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
||||
|
||||
//
|
||||
XCPOIDrawer *mPOIDrawer;
|
||||
XCPOIDetector *mPOIDetector;
|
||||
XCBarAnalyser *mBarAnalyser;
|
||||
|
||||
//
|
||||
XBarTracker mBarTracker;
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Expert initialization function |
|
||||
//+------------------------------------------------------------------+
|
||||
int OnInit()
|
||||
{
|
||||
//---
|
||||
mPOIDetector = new XCPOIDetector(
|
||||
_Symbol,
|
||||
_Period //
|
||||
);
|
||||
// mPOIDetector.Init();
|
||||
|
||||
//---
|
||||
mPOIDrawer = new XCPOIDrawer();
|
||||
|
||||
//---
|
||||
mBarAnalyser = new XCBarAnalyser();
|
||||
|
||||
//---
|
||||
mBarTracker.Init(
|
||||
_Symbol,
|
||||
_Period //
|
||||
);
|
||||
|
||||
//---
|
||||
return (INIT_SUCCEEDED);
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
//| Expert deinitialization function |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnDeinit(const int reason)
|
||||
{
|
||||
//---
|
||||
ZeroMemory(mPOIDrawer);
|
||||
ZeroMemory(mBarAnalyser);
|
||||
ZeroMemory(mPOIDetector);
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
//| Expert tick function |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnTick()
|
||||
{
|
||||
|
||||
//
|
||||
bool isNewBar = mBarTracker.IsNewBar();
|
||||
if (!isNewBar)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
ENUM_XPOI_EVENTS mPOIEvents[];
|
||||
mPOIDetector.Update(mPOIEvents);
|
||||
|
||||
//
|
||||
XPOIState mPOIState;
|
||||
mPOIDetector.GetState(mPOIState);
|
||||
|
||||
//
|
||||
bool has = mPOIState.HasFairValueGaps();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
int count = mPOIState.CountFairValueGaps();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
mPOIState.fairValueGaps[i].To(TimeCurrent());
|
||||
|
||||
//
|
||||
XCBaseObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateFairValueGap(
|
||||
mPOIState.fairValueGaps[i],
|
||||
iObj //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
Print("Salam");
|
||||
}
|
||||
|
||||
//
|
||||
return;
|
||||
|
||||
//
|
||||
XOHCL bar;
|
||||
bool isInited = bar.Init(
|
||||
_Symbol,
|
||||
_Period,
|
||||
0 //
|
||||
);
|
||||
if (!isInited)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int index = 0;
|
||||
ENUM_X_DIRECTION sameBarDir;
|
||||
bool hasSameBars = mBarAnalyser.HasSameBars(
|
||||
bar,
|
||||
sameBarDir,
|
||||
index,
|
||||
3 //
|
||||
);
|
||||
if (hasSameBars)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Fair Value Gap ...
|
||||
XOHCL fvgEndBar;
|
||||
XOHCL fvgStartBar;
|
||||
ENUM_X_DIRECTION fvgDir;
|
||||
bool hasFVG = mBarAnalyser.HasFairValueGap(
|
||||
bar,
|
||||
fvgStartBar,
|
||||
fvgEndBar,
|
||||
fvgDir,
|
||||
3 //
|
||||
);
|
||||
if (hasFVG)
|
||||
{
|
||||
//
|
||||
XCFVG *fvg;
|
||||
fvg = new XCFVG();
|
||||
bool isInit = fvg.Init(
|
||||
fvgStartBar,
|
||||
fvgEndBar,
|
||||
fvgDir //
|
||||
);
|
||||
// if (isInit)
|
||||
// {
|
||||
// //
|
||||
// XCBaseObject *iObj;
|
||||
// bool isCreated = mPOIDrawer.CreateFairValueGap(
|
||||
// fvg,
|
||||
// iObj //
|
||||
// );
|
||||
//
|
||||
// //
|
||||
// if (isCreated)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL obBar;
|
||||
ENUM_X_DIRECTION obDir;
|
||||
bool hasOB = mBarAnalyser.HasOrderBlock(
|
||||
bar,
|
||||
obBar,
|
||||
obDir,
|
||||
3 //
|
||||
);
|
||||
if (hasOB)
|
||||
{
|
||||
//
|
||||
XCOrderBlock *ob;
|
||||
ob = new XCOrderBlock();
|
||||
bool isInit = ob.Init(
|
||||
obBar,
|
||||
obDir //
|
||||
);
|
||||
if (isInit)
|
||||
{
|
||||
// //
|
||||
// XCBaseObject *iObj;
|
||||
// bool isCreated = mPOIDrawer.CreateOrderBlock(
|
||||
// ob,
|
||||
// iObj //
|
||||
// );
|
||||
|
||||
// //
|
||||
// if (isCreated)
|
||||
// {
|
||||
// Print("Order Block ...");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
Reference in New Issue
Block a user