last ...
This commit is contained in:
@@ -260,7 +260,7 @@ class XCBarAnalyser : public XCBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
index = bar.Index();
|
index = bar.Index() + 1;
|
||||||
bool canContinue = true;
|
bool canContinue = true;
|
||||||
int sameBullishBarsFounded = 0;
|
int sameBullishBarsFounded = 0;
|
||||||
int sameBearishBarsFounded = 0;
|
int sameBearishBarsFounded = 0;
|
||||||
@@ -297,12 +297,20 @@ class XCBarAnalyser : public XCBase
|
|||||||
sameBullishBarsFounded++;
|
sameBullishBarsFounded++;
|
||||||
canContinueForBearish = false;
|
canContinueForBearish = false;
|
||||||
}
|
}
|
||||||
else
|
else if (isBearish)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
sameBearishBarsFounded++;
|
sameBearishBarsFounded++;
|
||||||
canContinueForBullish = false;
|
canContinueForBullish = false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
sameBullishBarsFounded = 0;
|
||||||
|
sameBearishBarsFounded = 0;
|
||||||
|
canContinueForBullish = false;
|
||||||
|
canContinueForBearish = false;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = canContinueForBullish ||
|
result = canContinueForBullish ||
|
||||||
@@ -348,6 +356,9 @@ class XCBarAnalyser : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
index--;
|
||||||
|
|
||||||
//
|
//
|
||||||
dir =
|
dir =
|
||||||
hasBullishSameBars
|
hasBullishSameBars
|
||||||
@@ -2295,7 +2306,7 @@ class XCBarAnalyser : public XCBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
int obIndex = index;
|
int obIndex = index + 1;
|
||||||
result = ob.Init(
|
result = ob.Init(
|
||||||
bar.symbol,
|
bar.symbol,
|
||||||
bar.period,
|
bar.period,
|
||||||
@@ -2368,8 +2379,11 @@ class XCBarAnalyser : public XCBase
|
|||||||
bool isBullish = IsBullish(dir);
|
bool isBullish = IsBullish(dir);
|
||||||
|
|
||||||
//
|
//
|
||||||
int to = bar.Index() + 1;
|
int to = bar.Index();
|
||||||
int from = index + 1;
|
int from =
|
||||||
|
index > (to + sameBars)
|
||||||
|
? to + sameBars
|
||||||
|
: index;
|
||||||
for (int i = from; i > to; i--)
|
for (int i = from; i > to; i--)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
+247
-244
@@ -1157,7 +1157,7 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
iBar.Clean();
|
iBar.Clean();
|
||||||
mLock = false;
|
mLock = false;
|
||||||
mBarTracker.Waits();
|
// mBarTracker.Waits();
|
||||||
|
|
||||||
//
|
//
|
||||||
if (HasChild(events))
|
if (HasChild(events))
|
||||||
@@ -1332,251 +1332,8 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
protected:
|
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
void CleanCollections()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Clean(mSwings);
|
|
||||||
Clean(mSwingLows);
|
|
||||||
Clean(mSwingHighs);
|
|
||||||
Clean(mDemandZones);
|
|
||||||
Clean(mSupplyZones);
|
|
||||||
Clean(mOrderBlocks);
|
|
||||||
Clean(mMomentumBars);
|
|
||||||
Clean(mSupportZones);
|
|
||||||
Clean(mRejectionBars);
|
|
||||||
Clean(mFairValueGaps);
|
|
||||||
Clean(mEventListeners);
|
|
||||||
Clean(mResistanceZones);
|
|
||||||
Clean(mBullishOrderBlocks);
|
|
||||||
Clean(mBearishOrderBlocks);
|
|
||||||
Clean(mConsolidationZones);
|
|
||||||
Clean(mBullishMomentumBars);
|
|
||||||
Clean(mBearishMomentumBars);
|
|
||||||
Clean(mBullishRejectionBars);
|
|
||||||
Clean(mBearishRejectionBars);
|
|
||||||
Clean(mBullishFairValueGaps);
|
|
||||||
Clean(mBearishFairValueGaps);
|
|
||||||
Clean(mBullishConsolidationZones);
|
|
||||||
Clean(mBearishConsolidationZones);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
void ReverseCollections()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
ArrayReverse(mSwings);
|
|
||||||
ArrayReverse(mSwingLows);
|
|
||||||
ArrayReverse(mSwingHighs);
|
|
||||||
ArrayReverse(mDemandZones);
|
|
||||||
ArrayReverse(mSupplyZones);
|
|
||||||
ArrayReverse(mOrderBlocks);
|
|
||||||
ArrayReverse(mMomentumBars);
|
|
||||||
ArrayReverse(mSupportZones);
|
|
||||||
ArrayReverse(mRejectionBars);
|
|
||||||
ArrayReverse(mFairValueGaps);
|
|
||||||
ArrayReverse(mEventListeners);
|
|
||||||
ArrayReverse(mResistanceZones);
|
|
||||||
ArrayReverse(mBullishOrderBlocks);
|
|
||||||
ArrayReverse(mBearishOrderBlocks);
|
|
||||||
ArrayReverse(mConsolidationZones);
|
|
||||||
ArrayReverse(mBullishMomentumBars);
|
|
||||||
ArrayReverse(mBearishMomentumBars);
|
|
||||||
ArrayReverse(mBullishRejectionBars);
|
|
||||||
ArrayReverse(mBearishRejectionBars);
|
|
||||||
ArrayReverse(mBullishFairValueGaps);
|
|
||||||
ArrayReverse(mBearishFairValueGaps);
|
|
||||||
ArrayReverse(mBullishConsolidationZones);
|
|
||||||
ArrayReverse(mBearishConsolidationZones);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
void CleanupUnusedCollections(
|
|
||||||
int maxAllowed = 0 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
maxAllowed = MaxRequiredPOIs();
|
|
||||||
|
|
||||||
//
|
|
||||||
if (maxAllowed <= 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mEventListeners,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mSwings,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mSwingLows,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mSwingHighs,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mMomentumBars,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mBullishMomentumBars,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mBearishMomentumBars,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mRejectionBars,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mBullishRejectionBars,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mBearishRejectionBars,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mSupportZones,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mDemandZones,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mSupplyZones,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mResistanceZones,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mFairValueGaps,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mBullishFairValueGaps,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mBearishFairValueGaps,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mOrderBlocks,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mBullishOrderBlocks,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mBearishOrderBlocks,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mConsolidationZones,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mBullishConsolidationZones,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mBearishConsolidationZones,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notify Event Listeners ...
|
|
||||||
*
|
|
||||||
* @param event: ENUM_XPOI_EVENTS member, Specified Occured Event ...
|
|
||||||
* @param param: XCBasePOI implementation, Specified Event Object ...
|
|
||||||
*/
|
|
||||||
void NotifyEventListeners(
|
|
||||||
ENUM_XPOI_EVENTS event,
|
|
||||||
XCBasePOI *param //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int count = ArraySize(mEventListeners);
|
|
||||||
if (!IsValidSize(count))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
mEventListeners[i](
|
|
||||||
event,
|
|
||||||
param //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -3253,6 +3010,252 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
protected:
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
void CleanCollections()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(mSwings);
|
||||||
|
Clean(mSwingLows);
|
||||||
|
Clean(mSwingHighs);
|
||||||
|
Clean(mDemandZones);
|
||||||
|
Clean(mSupplyZones);
|
||||||
|
Clean(mOrderBlocks);
|
||||||
|
Clean(mMomentumBars);
|
||||||
|
Clean(mSupportZones);
|
||||||
|
Clean(mRejectionBars);
|
||||||
|
Clean(mFairValueGaps);
|
||||||
|
Clean(mEventListeners);
|
||||||
|
Clean(mResistanceZones);
|
||||||
|
Clean(mBullishOrderBlocks);
|
||||||
|
Clean(mBearishOrderBlocks);
|
||||||
|
Clean(mConsolidationZones);
|
||||||
|
Clean(mBullishMomentumBars);
|
||||||
|
Clean(mBearishMomentumBars);
|
||||||
|
Clean(mBullishRejectionBars);
|
||||||
|
Clean(mBearishRejectionBars);
|
||||||
|
Clean(mBullishFairValueGaps);
|
||||||
|
Clean(mBearishFairValueGaps);
|
||||||
|
Clean(mBullishConsolidationZones);
|
||||||
|
Clean(mBearishConsolidationZones);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void ReverseCollections()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ArrayReverse(mSwings);
|
||||||
|
ArrayReverse(mSwingLows);
|
||||||
|
ArrayReverse(mSwingHighs);
|
||||||
|
ArrayReverse(mDemandZones);
|
||||||
|
ArrayReverse(mSupplyZones);
|
||||||
|
ArrayReverse(mOrderBlocks);
|
||||||
|
ArrayReverse(mMomentumBars);
|
||||||
|
ArrayReverse(mSupportZones);
|
||||||
|
ArrayReverse(mRejectionBars);
|
||||||
|
ArrayReverse(mFairValueGaps);
|
||||||
|
ArrayReverse(mEventListeners);
|
||||||
|
ArrayReverse(mResistanceZones);
|
||||||
|
ArrayReverse(mBullishOrderBlocks);
|
||||||
|
ArrayReverse(mBearishOrderBlocks);
|
||||||
|
ArrayReverse(mConsolidationZones);
|
||||||
|
ArrayReverse(mBullishMomentumBars);
|
||||||
|
ArrayReverse(mBearishMomentumBars);
|
||||||
|
ArrayReverse(mBullishRejectionBars);
|
||||||
|
ArrayReverse(mBearishRejectionBars);
|
||||||
|
ArrayReverse(mBullishFairValueGaps);
|
||||||
|
ArrayReverse(mBearishFairValueGaps);
|
||||||
|
ArrayReverse(mBullishConsolidationZones);
|
||||||
|
ArrayReverse(mBearishConsolidationZones);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void CleanupUnusedCollections(
|
||||||
|
int maxAllowed = 0 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
maxAllowed = MaxRequiredPOIs();
|
||||||
|
|
||||||
|
//
|
||||||
|
if (maxAllowed <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mEventListeners,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mSwings,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mSwingLows,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mSwingHighs,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mMomentumBars,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mBullishMomentumBars,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mBearishMomentumBars,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mRejectionBars,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mBullishRejectionBars,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mBearishRejectionBars,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mSupportZones,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mDemandZones,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mSupplyZones,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mResistanceZones,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mFairValueGaps,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mBullishFairValueGaps,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mBearishFairValueGaps,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mOrderBlocks,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mBullishOrderBlocks,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mBearishOrderBlocks,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mConsolidationZones,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mBullishConsolidationZones,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mBearishConsolidationZones,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify Event Listeners ...
|
||||||
|
*
|
||||||
|
* @param event: ENUM_XPOI_EVENTS member, Specified Occured Event ...
|
||||||
|
* @param param: XCBasePOI implementation, Specified Event Object ...
|
||||||
|
*/
|
||||||
|
void NotifyEventListeners(
|
||||||
|
ENUM_XPOI_EVENTS event,
|
||||||
|
XCBasePOI *param //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = ArraySize(mEventListeners);
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mEventListeners[i](
|
||||||
|
event,
|
||||||
|
param //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -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 ...");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
+970
-1698
File diff suppressed because it is too large
Load Diff
@@ -7793,6 +7793,57 @@ int FindIndex(
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// Find Specific Item Index inside a Collection ...
|
||||||
|
template <typename T>
|
||||||
|
int FindIndex(
|
||||||
|
T &item, // Item to Find
|
||||||
|
const T &items[] // Items for Search
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Item Validation ...
|
||||||
|
if (!item.IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int itemsCount = ArraySize(items);
|
||||||
|
if (itemsCount <= 0)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < itemsCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
T iItem = items[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Item ...
|
||||||
|
if (!iItem.IsValid())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSame = item.IsSameAs(iItem);
|
||||||
|
if (isSame && result <= -1)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check an Array Contains Specified Value ...
|
// Check an Array Contains Specified Value ...
|
||||||
|
|||||||
@@ -2450,6 +2450,36 @@ int AddIfNotExists(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update to Time of Specifiex Collection ...
|
||||||
|
*
|
||||||
|
* @param items: XOBFVG instance Collection ...
|
||||||
|
* @param value: datetime ...
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
void SpecifiedUpdateTo(
|
||||||
|
T *&items[],
|
||||||
|
datetime value = NULL //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
value = NormalizeTime(value);
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(items);
|
||||||
|
bool has = HasChild(items);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
items[i].To(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
template <typename T>
|
template <typename T>
|
||||||
int FilterZones(
|
int FilterZones(
|
||||||
|
|||||||
@@ -2018,9 +2018,8 @@ class XCTwoBarZone : public XCZone
|
|||||||
XOHCL &startBar,
|
XOHCL &startBar,
|
||||||
XOHCL &endBar,
|
XOHCL &endBar,
|
||||||
ENUM_XPOIS type,
|
ENUM_XPOIS type,
|
||||||
bool useStartBarForUpper,
|
ENUM_X_PRICE startPrice,
|
||||||
ENUM_X_PRICE upperPrice,
|
ENUM_X_PRICE endPrice //
|
||||||
ENUM_X_PRICE lowerPrice //
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -2042,18 +2041,33 @@ class XCTwoBarZone : public XCZone
|
|||||||
mType = type;
|
mType = type;
|
||||||
mEndBar = endBar;
|
mEndBar = endBar;
|
||||||
mStartBar = startBar;
|
mStartBar = startBar;
|
||||||
mUpperPrice = upperPrice;
|
|
||||||
mLowerPrice = lowerPrice;
|
//
|
||||||
mUseStartBarForUpper = useStartBarForUpper;
|
int startIndex = startBar.Index();
|
||||||
|
int endIndex = endBar.Index();
|
||||||
|
|
||||||
mUpper =
|
//
|
||||||
useStartBarForUpper
|
double mStartPrice = startBar.GetPrice(startPrice);
|
||||||
? startBar.GetPrice(upperPrice)
|
double mEndPrice = endBar.GetPrice(endPrice);
|
||||||
: endBar.GetPrice(upperPrice);
|
bool isStartOverEnd = mStartPrice > mEndPrice;
|
||||||
mLower =
|
|
||||||
useStartBarForUpper
|
//
|
||||||
? endBar.GetPrice(lowerPrice)
|
if (isStartOverEnd)
|
||||||
: startBar.GetPrice(lowerPrice);
|
{
|
||||||
|
//
|
||||||
|
mUpperPrice = startPrice;
|
||||||
|
mLowerPrice = endPrice;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mUpperPrice = endPrice;
|
||||||
|
mLowerPrice = startPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mUpper = MathMax(mStartPrice, mEndPrice);
|
||||||
|
mLower = MathMin(mStartPrice, mEndPrice);
|
||||||
|
|
||||||
//
|
//
|
||||||
result = IsValidTwoBarZone();
|
result = IsValidTwoBarZone();
|
||||||
@@ -4342,24 +4356,20 @@ class XCFVG : public XCTwoBarZone
|
|||||||
: X_POI_BEARISH_FVG;
|
: X_POI_BEARISH_FVG;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool useFistForUpper = isDirBullish
|
ENUM_X_PRICE startPrice = isDirBullish
|
||||||
? false
|
? X_PRICE_HIGH
|
||||||
: true;
|
: X_PRICE_LOW;
|
||||||
ENUM_X_PRICE upPrice = isDirBullish
|
ENUM_X_PRICE endPrice = isDirBullish
|
||||||
? X_PRICE_LOW
|
? X_PRICE_LOW
|
||||||
: X_PRICE_HIGH;
|
: X_PRICE_HIGH;
|
||||||
ENUM_X_PRICE loPrice = isDirBullish
|
|
||||||
? X_PRICE_HIGH
|
|
||||||
: X_PRICE_LOW;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result = InitTwoBarZone(
|
result = InitTwoBarZone(
|
||||||
startBar,
|
startBar,
|
||||||
endBar,
|
endBar,
|
||||||
mTT,
|
mTT,
|
||||||
useFistForUpper,
|
startPrice,
|
||||||
upPrice,
|
endPrice //
|
||||||
loPrice //
|
|
||||||
);
|
);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5165,57 +5165,6 @@ bool IsStateFilterPassed(
|
|||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
|
||||||
// Find Specific Item Index inside a Collection ...
|
|
||||||
template <typename T>
|
|
||||||
int FindIndex(
|
|
||||||
T &item, // Item to Find
|
|
||||||
const T &items[] // Items for Search
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int result = -1;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Item Validation ...
|
|
||||||
if (!item.IsValid())
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int itemsCount = ArraySize(items);
|
|
||||||
if (itemsCount <= 0)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
for (int i = 0; i < itemsCount; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
T iItem = items[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
// Validate Item ...
|
|
||||||
if (!iItem.IsValid())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isSame = item.IsSameAs(iItem);
|
|
||||||
if (isSame && result <= -1)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
result = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user