last ...
This commit is contained in:
@@ -44,6 +44,8 @@ enum ENUM_XCHARTOBJECTS
|
|||||||
X_SIGNAL_OBJ = 8860,
|
X_SIGNAL_OBJ = 8860,
|
||||||
X_OHCL_OBJ = 8863,
|
X_OHCL_OBJ = 8863,
|
||||||
X_RR_OBJ = 8864,
|
X_RR_OBJ = 8864,
|
||||||
|
//
|
||||||
|
// 9860 Custom Object ...
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ENUM_X_CHART_IDS
|
enum ENUM_X_CHART_IDS
|
||||||
|
|||||||
@@ -747,7 +747,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
if (box.IsBullish())
|
if (box.IsBullish())
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
ApplyStyle(
|
ApplyBoxStyle(
|
||||||
object,
|
object,
|
||||||
boxBullishStyle //
|
boxBullishStyle //
|
||||||
);
|
);
|
||||||
@@ -755,7 +755,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
ApplyStyle(
|
ApplyBoxStyle(
|
||||||
object,
|
object,
|
||||||
boxBearishStyle //
|
boxBearishStyle //
|
||||||
);
|
);
|
||||||
@@ -1046,7 +1046,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
/**
|
/**
|
||||||
* Apply Specified Style to Object ...
|
* Apply Specified Style to Object ...
|
||||||
*/
|
*/
|
||||||
void ApplyStyle(
|
void ApplyBoxStyle(
|
||||||
XCBoxObject *&object,
|
XCBoxObject *&object,
|
||||||
XPOIStyle &style //
|
XPOIStyle &style //
|
||||||
)
|
)
|
||||||
@@ -1067,7 +1067,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
/**
|
/**
|
||||||
* Apply Specified Style to Object ...
|
* Apply Specified Style to Object ...
|
||||||
*/
|
*/
|
||||||
void ApplyStyle(
|
void ApplyBarArrowStyle(
|
||||||
XCBarArrowObject *&object,
|
XCBarArrowObject *&object,
|
||||||
XPOIStyle &style //
|
XPOIStyle &style //
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,186 @@
|
|||||||
|
// //
|
||||||
|
// // Detect At lease Two PEAK and Two Vale ...
|
||||||
|
// XZigZagPoint tmpPoints[];
|
||||||
|
// Copy(
|
||||||
|
// points,
|
||||||
|
// tmpPoints //
|
||||||
|
// );
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Detect Highs ...
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Highest High ...
|
||||||
|
|
||||||
|
// //
|
||||||
|
// XZigZagPoint iZGPeak1;
|
||||||
|
// XZigZagPoint iZGPeak2;
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // First ...
|
||||||
|
// int idx = GetHighest(
|
||||||
|
// tmpPoints,
|
||||||
|
// X_ZIGZAG_POINT_TYPE_PEAK //
|
||||||
|
// );
|
||||||
|
// result = IsValidIndex(idx);
|
||||||
|
// if (!result)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// Clean();
|
||||||
|
// iZGPeak1.Clean();
|
||||||
|
// iZGPeak2.Clean();
|
||||||
|
// SpecifiedClean(tmpPoints);
|
||||||
|
|
||||||
|
// //
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
// iZGPeak1 = tmpPoints[idx];
|
||||||
|
// ArrayRemove(
|
||||||
|
// tmpPoints,
|
||||||
|
// idx,
|
||||||
|
// 1 //
|
||||||
|
// );
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Second ...
|
||||||
|
// idx = GetHighest(
|
||||||
|
// tmpPoints,
|
||||||
|
// X_ZIGZAG_POINT_TYPE_PEAK //
|
||||||
|
// );
|
||||||
|
// result = IsValidIndex(idx);
|
||||||
|
// if (!result)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// Clean();
|
||||||
|
// iZGPeak1.Clean();
|
||||||
|
// iZGPeak2.Clean();
|
||||||
|
// SpecifiedClean(tmpPoints);
|
||||||
|
|
||||||
|
// //
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
// iZGPeak2 = tmpPoints[idx];
|
||||||
|
// ArrayRemove(
|
||||||
|
// tmpPoints,
|
||||||
|
// idx,
|
||||||
|
// 1 //
|
||||||
|
// );
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Detect Lows ...
|
||||||
|
|
||||||
|
// //
|
||||||
|
// XZigZagPoint iZGVale1;
|
||||||
|
// XZigZagPoint iZGVale2;
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // First ...
|
||||||
|
// idx = GetLowest(
|
||||||
|
// tmpPoints,
|
||||||
|
// X_ZIGZAG_POINT_TYPE_VALE //
|
||||||
|
// );
|
||||||
|
// result = IsValidIndex(idx);
|
||||||
|
// if (!result)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// Clean();
|
||||||
|
// iZGPeak1.Clean();
|
||||||
|
// iZGPeak2.Clean();
|
||||||
|
// iZGVale1.Clean();
|
||||||
|
// iZGVale2.Clean();
|
||||||
|
// SpecifiedClean(tmpPoints);
|
||||||
|
|
||||||
|
// //
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
// iZGVale1 = tmpPoints[idx];
|
||||||
|
// ArrayRemove(
|
||||||
|
// tmpPoints,
|
||||||
|
// idx,
|
||||||
|
// 1 //
|
||||||
|
// );
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Second ...
|
||||||
|
// idx = GetLowest(
|
||||||
|
// tmpPoints,
|
||||||
|
// X_ZIGZAG_POINT_TYPE_VALE //
|
||||||
|
// );
|
||||||
|
// result = IsValidIndex(idx);
|
||||||
|
// if (!result)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// Clean();
|
||||||
|
// iZGPeak1.Clean();
|
||||||
|
// iZGPeak2.Clean();
|
||||||
|
// iZGVale1.Clean();
|
||||||
|
// iZGVale2.Clean();
|
||||||
|
// SpecifiedClean(tmpPoints);
|
||||||
|
|
||||||
|
// //
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
// iZGVale2 = tmpPoints[idx];
|
||||||
|
// ArrayRemove(
|
||||||
|
// tmpPoints,
|
||||||
|
// idx,
|
||||||
|
// 1 //
|
||||||
|
// );
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Check Directions ...
|
||||||
|
// bool isBullish =
|
||||||
|
// //
|
||||||
|
// (iZGPeak1.time > iZGPeak2.time &&
|
||||||
|
// iZGVale1.time < iZGVale2.time)
|
||||||
|
// //
|
||||||
|
// ;
|
||||||
|
// bool isBearish =
|
||||||
|
// //
|
||||||
|
// (iZGPeak1.time < iZGPeak2.time &&
|
||||||
|
// iZGVale1.time > iZGVale2.time)
|
||||||
|
// //
|
||||||
|
// ;
|
||||||
|
// result =
|
||||||
|
// (isBullish && !isBearish) ||
|
||||||
|
// (isBearish && !isBullish);
|
||||||
|
// if (!result)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// Clean();
|
||||||
|
// iZGPeak1.Clean();
|
||||||
|
// iZGPeak2.Clean();
|
||||||
|
// iZGVale1.Clean();
|
||||||
|
// iZGVale2.Clean();
|
||||||
|
// SpecifiedClean(tmpPoints);
|
||||||
|
|
||||||
|
// //
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Setting Direction ...
|
||||||
|
// dir =
|
||||||
|
// isBullish
|
||||||
|
// ? X_DIRECTION_BULLISH
|
||||||
|
// : isBearish
|
||||||
|
// ? X_DIRECTION_BEARISH
|
||||||
|
// : X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Setting Points ...
|
||||||
|
// Copy(
|
||||||
|
// points,
|
||||||
|
// pivots //
|
||||||
|
// );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Resources ...
|
||||||
|
// iZGPeak1.Clean();
|
||||||
|
// iZGPeak2.Clean();
|
||||||
|
// iZGVale1.Clean();
|
||||||
|
// iZGVale2.Clean();
|
||||||
|
// SpecifiedClean(tmpPoints);
|
||||||
@@ -25,8 +25,6 @@
|
|||||||
//
|
//
|
||||||
// Imports ...
|
// Imports ...
|
||||||
#include "../Classes/x-saherelm.x-backtester.expert.class.mq5"
|
#include "../Classes/x-saherelm.x-backtester.expert.class.mq5"
|
||||||
#include "../Classes/x-saherelm.x-market.pattern.class.mq5"
|
|
||||||
#include "../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
|
||||||
#include "../XFIMAEA/Classes/x-saherelm.xfima.signaller.class.mq5"
|
#include "../XFIMAEA/Classes/x-saherelm.xfima.signaller.class.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -140,10 +138,8 @@ input int valeArrowCode = 159; // Vales Arrow Code
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Requirements ...
|
// Requirements ...
|
||||||
string eaLogTag; // EA Log Prefix ...
|
string eaLogTag; // EA Log Prefix ...
|
||||||
XCBackTesterEA *eaExpert; // EA Expert ...
|
XCBackTesterEA *eaExpert; // EA Expert ...
|
||||||
XCXFIMAPOIDetector *fimaPOIDetector; // EA Fima POI Detector ...
|
|
||||||
XCMarketPatternDetector *eaPatternDetector; // EA Pattern Detector ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Registered Signallers ...
|
// Registered Signallers ...
|
||||||
@@ -152,8 +148,7 @@ XCXFIMAStrategy2Signaller *fima2Signaller; // XFIMA2 Signaller ...
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Drawer and Draws ...
|
// Drawer and Draws ...
|
||||||
XCPOIDrawer *eaDrawer; // Ea POI Drawer ...
|
CArrayObj draws; // Drawn Objects ...
|
||||||
CArrayObj draws; // Drawn Objects ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
XBarTracker eaBarTracker; // EA Bar Traker ...
|
XBarTracker eaBarTracker; // EA Bar Traker ...
|
||||||
@@ -384,17 +379,6 @@ int OnInit()
|
|||||||
return INIT_FAILED;
|
return INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Instantiate Market Pattern Detector ...
|
|
||||||
eaPatternDetector = new XCMarketPatternDetector();
|
|
||||||
|
|
||||||
//
|
|
||||||
fimaPOIDetector = new XCXFIMAPOIDetector();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Instantiate POI Drawer ...
|
|
||||||
eaDrawer = new XCPOIDrawer();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
Print(ShortName, ": Initialized Successfully ...");
|
Print(ShortName, ": Initialized Successfully ...");
|
||||||
return INIT_SUCCEEDED;
|
return INIT_SUCCEEDED;
|
||||||
@@ -427,14 +411,6 @@ void OnDeinit(const int reason)
|
|||||||
//
|
//
|
||||||
eaBarTracker.Clean();
|
eaBarTracker.Clean();
|
||||||
|
|
||||||
//
|
|
||||||
delete eaDrawer;
|
|
||||||
ZeroMemory(eaDrawer);
|
|
||||||
|
|
||||||
//
|
|
||||||
delete eaPatternDetector;
|
|
||||||
ZeroMemory(eaPatternDetector);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
delete fima1Signaller;
|
delete fima1Signaller;
|
||||||
ZeroMemory(fima1Signaller);
|
ZeroMemory(fima1Signaller);
|
||||||
@@ -443,10 +419,6 @@ void OnDeinit(const int reason)
|
|||||||
delete fima2Signaller;
|
delete fima2Signaller;
|
||||||
ZeroMemory(fima2Signaller);
|
ZeroMemory(fima2Signaller);
|
||||||
|
|
||||||
//
|
|
||||||
delete fimaPOIDetector;
|
|
||||||
ZeroMemory(fimaPOIDetector);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
delete eaExpert;
|
delete eaExpert;
|
||||||
ZeroMemory(eaExpert);
|
ZeroMemory(eaExpert);
|
||||||
@@ -641,9 +613,9 @@ void OnSignalTriggered(XSignal &signal)
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool has = iObj.Create(
|
bool has = iObj.Create(
|
||||||
eaDrawer.ChartIdentification(),
|
fima2Signaller.fimaPOIDrawer.ChartIdentification(),
|
||||||
iName,
|
iName,
|
||||||
eaDrawer.SubWindowIdentification(),
|
fima2Signaller.fimaPOIDrawer.SubWindowIdentification(),
|
||||||
signal.time //
|
signal.time //
|
||||||
);
|
);
|
||||||
if (has)
|
if (has)
|
||||||
@@ -851,7 +823,7 @@ void DetectPatterns()
|
|||||||
if (detectMomentum)
|
if (detectMomentum)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool isMomentum = eaPatternDetector.IsMomentumBar(
|
bool isMomentum = fima2Signaller.fimaPOIDetector.IsMomentumBar(
|
||||||
cBar,
|
cBar,
|
||||||
iDir //
|
iDir //
|
||||||
);
|
);
|
||||||
@@ -870,7 +842,7 @@ void DetectPatterns()
|
|||||||
if (detectEngulfed)
|
if (detectEngulfed)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool isEngulfed = eaPatternDetector.IsEngulfedBar(
|
bool isEngulfed = fima2Signaller.fimaPOIDetector.IsEngulfedBar(
|
||||||
cBar,
|
cBar,
|
||||||
iDir //
|
iDir //
|
||||||
);
|
);
|
||||||
@@ -889,7 +861,7 @@ void DetectPatterns()
|
|||||||
if (detectTrueGaped)
|
if (detectTrueGaped)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool isTrueGaped = eaPatternDetector.IsTrueGapedBar(
|
bool isTrueGaped = fima2Signaller.fimaPOIDetector.IsTrueGapedBar(
|
||||||
cBar,
|
cBar,
|
||||||
iDir //
|
iDir //
|
||||||
);
|
);
|
||||||
@@ -907,7 +879,7 @@ void DetectPatterns()
|
|||||||
// Checking Pinned Bar ...
|
// Checking Pinned Bar ...
|
||||||
if (detectPinned)
|
if (detectPinned)
|
||||||
{
|
{
|
||||||
bool isPinned = eaPatternDetector.IsPinnedBar(
|
bool isPinned = fima2Signaller.fimaPOIDetector.IsPinnedBar(
|
||||||
cBar,
|
cBar,
|
||||||
iDir //
|
iDir //
|
||||||
);
|
);
|
||||||
@@ -925,7 +897,7 @@ void DetectPatterns()
|
|||||||
// Checking Star Pattern ...
|
// Checking Star Pattern ...
|
||||||
if (detectStarPattern)
|
if (detectStarPattern)
|
||||||
{
|
{
|
||||||
bool isStarPattern = eaPatternDetector.IsStartPattern(
|
bool isStarPattern = fima2Signaller.fimaPOIDetector.IsStartPattern(
|
||||||
cBar,
|
cBar,
|
||||||
iDir //
|
iDir //
|
||||||
);
|
);
|
||||||
@@ -944,7 +916,7 @@ void DetectPatterns()
|
|||||||
if (detectPiercingPattern)
|
if (detectPiercingPattern)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool isPiercingPattern = eaPatternDetector.IsPiercingPattern(
|
bool isPiercingPattern = fima2Signaller.fimaPOIDetector.IsPiercingPattern(
|
||||||
cBar,
|
cBar,
|
||||||
iDir //
|
iDir //
|
||||||
);
|
);
|
||||||
@@ -963,7 +935,7 @@ void DetectPatterns()
|
|||||||
if (detectRisingPattern)
|
if (detectRisingPattern)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool isRisingPattern = eaPatternDetector.IsRisingPattern(
|
bool isRisingPattern = fima2Signaller.fimaPOIDetector.IsRisingPattern(
|
||||||
cBar,
|
cBar,
|
||||||
iDir //
|
iDir //
|
||||||
);
|
);
|
||||||
@@ -983,7 +955,7 @@ void DetectPatterns()
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
XOHCL swingBar;
|
XOHCL swingBar;
|
||||||
bool isFlagPattern = eaPatternDetector.IsFlagPattern(
|
bool isFlagPattern = fima2Signaller.fimaPOIDetector.IsFlagPattern(
|
||||||
cBar,
|
cBar,
|
||||||
iDir,
|
iDir,
|
||||||
swingBar //
|
swingBar //
|
||||||
@@ -1004,7 +976,7 @@ void DetectPatterns()
|
|||||||
if (detectSignalKeyBarPattern)
|
if (detectSignalKeyBarPattern)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool isSignalKeyBar = eaPatternDetector.IsSignalKeyBarPattern(
|
bool isSignalKeyBar = fima2Signaller.fimaPOIDetector.IsSignalKeyBarPattern(
|
||||||
cBar,
|
cBar,
|
||||||
iDir //
|
iDir //
|
||||||
);
|
);
|
||||||
@@ -1024,7 +996,7 @@ void DetectPatterns()
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
XOHCL swings[];
|
XOHCL swings[];
|
||||||
bool hasSwingTrend = eaPatternDetector.HasSwingTrend(
|
bool hasSwingTrend = fima2Signaller.fimaPOIDetector.HasSwingTrend(
|
||||||
cBar,
|
cBar,
|
||||||
iDir,
|
iDir,
|
||||||
swings //
|
swings //
|
||||||
@@ -1040,7 +1012,7 @@ void DetectPatterns()
|
|||||||
|
|
||||||
//
|
//
|
||||||
CChartObjectTrend *iObj;
|
CChartObjectTrend *iObj;
|
||||||
has = eaDrawer.DrawSwingTrend(
|
has = fima2Signaller.fimaPOIDrawer.DrawSwingTrend(
|
||||||
swings,
|
swings,
|
||||||
iDir,
|
iDir,
|
||||||
iObj,
|
iObj,
|
||||||
@@ -1060,7 +1032,7 @@ void DetectPatterns()
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
XOHCL swings[];
|
XOHCL swings[];
|
||||||
bool hasSwingTrend = eaPatternDetector.HasSwingTrend(
|
bool hasSwingTrend = fima2Signaller.fimaPOIDetector.HasSwingTrend(
|
||||||
cBar,
|
cBar,
|
||||||
iDir,
|
iDir,
|
||||||
swings //
|
swings //
|
||||||
@@ -1097,7 +1069,7 @@ void DetectPatterns()
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
XOHCL support;
|
XOHCL support;
|
||||||
bool hasSupport = eaPatternDetector.HasSupport(
|
bool hasSupport = fima2Signaller.fimaPOIDetector.HasSupport(
|
||||||
cBar,
|
cBar,
|
||||||
support //
|
support //
|
||||||
);
|
);
|
||||||
@@ -1111,20 +1083,12 @@ void DetectPatterns()
|
|||||||
//
|
//
|
||||||
// Draw Box ...
|
// Draw Box ...
|
||||||
XCBoxObject *iObj;
|
XCBoxObject *iObj;
|
||||||
has = eaDrawer.DrawBox(
|
has = fima2Signaller.fimaPOIDrawer.DrawBox(
|
||||||
supportBox,
|
supportBox,
|
||||||
iObj //
|
iObj //
|
||||||
);
|
);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Apply Style ...
|
|
||||||
eaDrawer.ApplyStyle(
|
|
||||||
iObj,
|
|
||||||
eaDrawer.boxBullishStyle //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
draws.Add(iObj);
|
draws.Add(iObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1144,7 +1108,7 @@ void DetectPatterns()
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
XOHCL resistance;
|
XOHCL resistance;
|
||||||
bool hasResistance = eaPatternDetector.HasResistance(
|
bool hasResistance = fima2Signaller.fimaPOIDetector.HasResistance(
|
||||||
cBar,
|
cBar,
|
||||||
resistance //
|
resistance //
|
||||||
);
|
);
|
||||||
@@ -1158,20 +1122,12 @@ void DetectPatterns()
|
|||||||
//
|
//
|
||||||
// Draw Box ...
|
// Draw Box ...
|
||||||
XCBoxObject *iObj;
|
XCBoxObject *iObj;
|
||||||
has = eaDrawer.DrawBox(
|
has = fima2Signaller.fimaPOIDrawer.DrawBox(
|
||||||
resistanceBox,
|
resistanceBox,
|
||||||
iObj //
|
iObj //
|
||||||
);
|
);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Apply Style ...
|
|
||||||
eaDrawer.ApplyStyle(
|
|
||||||
iObj,
|
|
||||||
eaDrawer.boxBearishStyle //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
draws.Add(iObj);
|
draws.Add(iObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1194,93 +1150,30 @@ void DetectPatterns()
|
|||||||
if (detectZIGZAGPatterns)
|
if (detectZIGZAGPatterns)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XZigZagPoint zigzags[];
|
// Detect Market Analysis ...
|
||||||
int zigzagsCount = fimaPOIDetector.GetZigZagPoint(
|
XZigZagAnalysis zAnalysis;
|
||||||
|
has = fima2Signaller.fimaPOIDetector.AnalyseMarketUsingZigZag(
|
||||||
cBar,
|
cBar,
|
||||||
|
cBar.period,
|
||||||
fima2Signaller.fimaHelper,
|
fima2Signaller.fimaHelper,
|
||||||
zigzags,
|
zAnalysis,
|
||||||
15 //
|
15 //
|
||||||
);
|
);
|
||||||
has = IsValidSize(zigzagsCount);
|
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Analyse Using ZigZag ...
|
Print(ShortName + zAnalysis.GetMessage());
|
||||||
XZigZagAnalysis cZGAnalysis;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check ZG Analysis Exists ...
|
XCZigZagAnalysisObject *iObj;
|
||||||
has = cZGAnalysis.Analyse(
|
has = fima2Signaller.fimaPOIDrawer.DrawZigZagMarketAnalysis(
|
||||||
cBar,
|
iObj,
|
||||||
zigzags //
|
zAnalysis //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Check Exists ZG Analysis isn't Same Trend as Prev ...
|
|
||||||
has =
|
|
||||||
has &&
|
|
||||||
(!zigzagAnalysis.IsValid()
|
|
||||||
? true
|
|
||||||
: !zigzagAnalysis.IsSameTrendAs(cZGAnalysis));
|
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
draws.Add(iObj);
|
||||||
// Update Prev Analysis ...
|
|
||||||
zigzagAnalysis = cZGAnalysis;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Notify Only When New Trending Happens ...
|
|
||||||
Print("Detected ZigZags Pivots Analysis: ", zigzagAnalysis.GetMessage());
|
|
||||||
|
|
||||||
//
|
|
||||||
// Draw Trend Line ...
|
|
||||||
|
|
||||||
//
|
|
||||||
string iObjID = zigzagAnalysis.GetObjectID();
|
|
||||||
string iNameType = ToXString(zigzagAnalysis.dir) + "_Trend";
|
|
||||||
|
|
||||||
//
|
|
||||||
// Upper Line ...
|
|
||||||
string iUpperName = iNameType + "_Upper_" + iObjID;
|
|
||||||
CChartObjectTrend *iUpperObj;
|
|
||||||
has = eaDrawer.DrawTrendLine(
|
|
||||||
zigzagAnalysis.lastPeak.value,
|
|
||||||
zigzagAnalysis.lastPeak.time,
|
|
||||||
zigzagAnalysis.recentPeak.value,
|
|
||||||
zigzagAnalysis.recentPeak.time,
|
|
||||||
iUpperObj,
|
|
||||||
ToMD5(iUpperName),
|
|
||||||
true //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lower Line ...
|
|
||||||
string iLowerName = iNameType + "_Lower_" + iObjID;
|
|
||||||
CChartObjectTrend *iLowerObj;
|
|
||||||
has =
|
|
||||||
has &&
|
|
||||||
eaDrawer.DrawTrendLine(
|
|
||||||
zigzagAnalysis.lastVale.value,
|
|
||||||
zigzagAnalysis.lastVale.time,
|
|
||||||
zigzagAnalysis.recentVale.value,
|
|
||||||
zigzagAnalysis.recentVale.time,
|
|
||||||
iLowerObj,
|
|
||||||
ToMD5(iLowerName),
|
|
||||||
true //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (has) {
|
|
||||||
//
|
|
||||||
// Apply Style on Trend Lines ...
|
|
||||||
|
|
||||||
//
|
|
||||||
draws.Add(iUpperObj);
|
|
||||||
draws.Add(iLowerObj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "../../Classes/x-saherelm.x-signaller.class.mq5"
|
#include "../../Classes/x-saherelm.x-signaller.class.mq5"
|
||||||
#include "../../Helpers/x-saherelm.xfima.helper.mq5"
|
#include "../../Helpers/x-saherelm.xfima.helper.mq5"
|
||||||
#include "../Classes/x-saherelm.xfima.x-poi.detector.class.mq5"
|
#include "../Classes/x-saherelm.xfima.x-poi.detector.class.mq5"
|
||||||
|
#include "../Classes/x-saherelm.xfima.x-poi.drawer.class.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Implementation ...
|
// Implementation ...
|
||||||
@@ -42,6 +43,7 @@ class XCXFIMABaseSignaller : public XCBaseSignaller
|
|||||||
//
|
//
|
||||||
XFIMAInputs fimaInputs; // XFIMA Inputs ...
|
XFIMAInputs fimaInputs; // XFIMA Inputs ...
|
||||||
XCXFIMAHelper *fimaHelper; // XFIMA Indicator Helper ...
|
XCXFIMAHelper *fimaHelper; // XFIMA Indicator Helper ...
|
||||||
|
XCXFIMAPOIDrawer *fimaPOIDrawer; // XFIMA POI Drawer ...
|
||||||
XCXFIMAPOIDetector *fimaPOIDetector; // XFIMA POI Detector ...
|
XCXFIMAPOIDetector *fimaPOIDetector; // XFIMA POI Detector ...
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -88,6 +90,7 @@ class XCXFIMABaseSignaller : public XCBaseSignaller
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
fimaPOIDrawer = new XCXFIMAPOIDrawer();
|
||||||
fimaPOIDetector = new XCXFIMAPOIDetector();
|
fimaPOIDetector = new XCXFIMAPOIDetector();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +122,10 @@ class XCXFIMABaseSignaller : public XCBaseSignaller
|
|||||||
delete fimaHelper;
|
delete fimaHelper;
|
||||||
ZeroMemory(fimaHelper);
|
ZeroMemory(fimaHelper);
|
||||||
|
|
||||||
|
//
|
||||||
|
delete fimaPOIDrawer;
|
||||||
|
ZeroMemory(fimaPOIDrawer);
|
||||||
|
|
||||||
//
|
//
|
||||||
delete fimaPOIDetector;
|
delete fimaPOIDetector;
|
||||||
ZeroMemory(fimaPOIDetector);
|
ZeroMemory(fimaPOIDetector);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Implementation ...
|
// Implementation ...
|
||||||
class XCXFIMAPOIDetector : public XCBase
|
class XCXFIMAPOIDetector : public XCMarketPatternDetector
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Public ...
|
// Public ...
|
||||||
@@ -37,7 +37,6 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XCBarAnalyser *barAnalyser; // Bar Analyser ...
|
XCBarAnalyser *barAnalyser; // Bar Analyser ...
|
||||||
XCMarketPatternDetector *patternDetector; // Pattern Detector ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
@@ -45,7 +44,6 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
barAnalyser = new XCBarAnalyser();
|
barAnalyser = new XCBarAnalyser();
|
||||||
patternDetector = new XCMarketPatternDetector();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -64,15 +62,15 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
* @param bar: XOHCL, Specified Bar for Start ...
|
* @param bar: XOHCL, Specified Bar for Start ...
|
||||||
* @param fimaHelper: XCXFIMAHelper, instance of XFIMA Helper ...
|
* @param fimaHelper: XCXFIMAHelper, instance of XFIMA Helper ...
|
||||||
* @param zigzagPoints: XZigZagPoint, Array of Founded Points ...
|
* @param zigzagPoints: XZigZagPoint, Array of Founded Points ...
|
||||||
* @param numberOfRequiredPoints: int, Specified Number of required ZigZag Points ...
|
* @param numberOfRequiredPivots: int, Specified Number of required ZigZag Points ...
|
||||||
*
|
*
|
||||||
* @return ( int )
|
* @return ( int )
|
||||||
*/
|
*/
|
||||||
int GetZigZagPoint(
|
int GetZigZagPivot(
|
||||||
XOHCL &bar,
|
XOHCL &bar,
|
||||||
XCXFIMAHelper *&fimaHelper,
|
XCXFIMAHelper *&fimaHelper,
|
||||||
XZigZagPoint &zigzagPoints[],
|
XZigZagPivot &zigzagPivots[],
|
||||||
int numberOfRequiredPoints = 5 //
|
int numberOfRequiredPivots = 5 //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -80,8 +78,8 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Normalize ...
|
// Normalize ...
|
||||||
SpecifiedClean(zigzagPoints);
|
SpecifiedClean(zigzagPivots);
|
||||||
numberOfRequiredPoints = NormalizeInt(numberOfRequiredPoints, 3);
|
numberOfRequiredPivots = NormalizeInt(numberOfRequiredPivots, 3);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate ...
|
// Validate ...
|
||||||
@@ -106,13 +104,13 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
int iPZGIdx = -1;
|
int iPZGIdx = -1;
|
||||||
bool has = false;
|
bool has = false;
|
||||||
int start = index;
|
int start = index;
|
||||||
XZigZagPoint iZGPoint;
|
XZigZagPivot iZGPoint;
|
||||||
datetime iZGTime = NULL;
|
datetime iZGTime = NULL;
|
||||||
datetime iPZGTime = NULL;
|
datetime iPZGTime = NULL;
|
||||||
int lastZGDetected = start;
|
int lastZGDetected = start;
|
||||||
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
|
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
|
||||||
ENUM_X_ZIGZAG_POINT_TYPE iType = X_ZIGZAG_POINT_TYPE_NONE;
|
ENUM_X_ZIGZAG_POINT_TYPE iType = X_ZIGZAG_PIVOT_TYPE_NONE;
|
||||||
while (ArraySize(zigzagPoints) < numberOfRequiredPoints)
|
while (ArraySize(zigzagPivots) < numberOfRequiredPivots)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Reading Last two ZigZag Value ...
|
// Reading Last two ZigZag Value ...
|
||||||
@@ -131,7 +129,7 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
iPZGTime = NULL;
|
iPZGTime = NULL;
|
||||||
iZGPoint.Clean();
|
iZGPoint.Clean();
|
||||||
iDir = X_DIRECTION_NONE;
|
iDir = X_DIRECTION_NONE;
|
||||||
iType = X_ZIGZAG_POINT_TYPE_NONE;
|
iType = X_ZIGZAG_PIVOT_TYPE_NONE;
|
||||||
|
|
||||||
//
|
//
|
||||||
start++;
|
start++;
|
||||||
@@ -155,7 +153,7 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
iPZGTime = NULL;
|
iPZGTime = NULL;
|
||||||
iZGPoint.Clean();
|
iZGPoint.Clean();
|
||||||
iDir = X_DIRECTION_NONE;
|
iDir = X_DIRECTION_NONE;
|
||||||
iType = X_ZIGZAG_POINT_TYPE_NONE;
|
iType = X_ZIGZAG_PIVOT_TYPE_NONE;
|
||||||
|
|
||||||
//
|
//
|
||||||
start++;
|
start++;
|
||||||
@@ -178,10 +176,10 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
// Check Point Type ...
|
// Check Point Type ...
|
||||||
iType =
|
iType =
|
||||||
IsSpecifiedBullish(iDir)
|
IsSpecifiedBullish(iDir)
|
||||||
? X_ZIGZAG_POINT_TYPE_PEAK
|
? X_ZIGZAG_PIVOT_TYPE_PEAK
|
||||||
: IsSpecifiedBearish(iDir)
|
: IsSpecifiedBearish(iDir)
|
||||||
? X_ZIGZAG_POINT_TYPE_VALE
|
? X_ZIGZAG_PIVOT_TYPE_VALE
|
||||||
: X_ZIGZAG_POINT_TYPE_NONE;
|
: X_ZIGZAG_PIVOT_TYPE_NONE;
|
||||||
has =
|
has =
|
||||||
IsXValid(iType) &&
|
IsXValid(iType) &&
|
||||||
HasDirection(iDir);
|
HasDirection(iDir);
|
||||||
@@ -196,7 +194,7 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
iPZGTime = NULL;
|
iPZGTime = NULL;
|
||||||
iZGPoint.Clean();
|
iZGPoint.Clean();
|
||||||
iDir = X_DIRECTION_NONE;
|
iDir = X_DIRECTION_NONE;
|
||||||
iType = X_ZIGZAG_POINT_TYPE_NONE;
|
iType = X_ZIGZAG_PIVOT_TYPE_NONE;
|
||||||
|
|
||||||
//
|
//
|
||||||
start++;
|
start++;
|
||||||
@@ -219,7 +217,7 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
iZGPoint.AddIfNotExists(zigzagPoints);
|
iZGPoint.AddIfNotExists(zigzagPivots);
|
||||||
lastZGDetected = iZGIdx + 1;
|
lastZGDetected = iZGIdx + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,14 +231,14 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
iPZGTime = NULL;
|
iPZGTime = NULL;
|
||||||
iZGPoint.Clean();
|
iZGPoint.Clean();
|
||||||
iDir = X_DIRECTION_NONE;
|
iDir = X_DIRECTION_NONE;
|
||||||
iType = X_ZIGZAG_POINT_TYPE_NONE;
|
iType = X_ZIGZAG_PIVOT_TYPE_NONE;
|
||||||
|
|
||||||
//
|
//
|
||||||
start++;
|
start++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = ArraySize(zigzagPoints);
|
result = ArraySize(zigzagPivots);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -250,7 +248,9 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
bool AnalyseMarketUsingZigZag(
|
bool AnalyseMarketUsingZigZag(
|
||||||
XOHCL &bar,
|
XOHCL &bar,
|
||||||
ENUM_TIMEFRAMES forPeriod,
|
ENUM_TIMEFRAMES forPeriod,
|
||||||
XZigZagAnalysis &analysis //
|
XCXFIMAHelper *&fimaHelper,
|
||||||
|
XZigZagAnalysis &analysis,
|
||||||
|
int numberOfRequiredPivots = 20 //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -270,6 +270,7 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Normalize ...
|
// Normalize ...
|
||||||
|
numberOfRequiredPivots = NormalizeInt(numberOfRequiredPivots, 5);
|
||||||
if (!IsSpecifiedValid(forPeriod))
|
if (!IsSpecifiedValid(forPeriod))
|
||||||
{
|
{
|
||||||
forPeriod = bar.period;
|
forPeriod = bar.period;
|
||||||
@@ -277,365 +278,55 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Reading XZigZag Points ...
|
// Reading XZigZag Points ...
|
||||||
|
XOHCL iPeriodBar;
|
||||||
|
result = iPeriodBar.Init(
|
||||||
|
bar.symbol,
|
||||||
|
forPeriod,
|
||||||
|
bar.Index() //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iPeriodBar.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Reading Required Pivots ...
|
||||||
|
XZigZagPivot pivots[];
|
||||||
|
int pivotsCount = GetZigZagPivot(
|
||||||
|
iPeriodBar,
|
||||||
|
fimaHelper,
|
||||||
|
pivots,
|
||||||
|
numberOfRequiredPivots //
|
||||||
|
);
|
||||||
|
result = IsValidSize(pivotsCount);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
analysis.Clean();
|
||||||
|
iPeriodBar.Clean();
|
||||||
|
SpecifiedClean(pivots);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize Analysis Model ...
|
||||||
|
result = analysis.Analyse(
|
||||||
|
bar,
|
||||||
|
pivots //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
analysis.Clean();
|
||||||
|
iPeriodBar.Clean();
|
||||||
|
SpecifiedClean(pivots);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Implementing Patrren Detector ...
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Specified Bar is Momentum Bar or not ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
|
||||||
* @param requiredBars: int, bar range for approve Momentum ...
|
|
||||||
* @param approvedMultiplier: int, a Multipler for approve Momentum ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsMomentumBar(
|
|
||||||
XOHCL &bar,
|
|
||||||
ENUM_X_DIRECTION &dir,
|
|
||||||
int requiredBars = 3,
|
|
||||||
int approvedMultiplier = 2 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return patternDetector.IsMomentumBar(
|
|
||||||
bar,
|
|
||||||
dir,
|
|
||||||
requiredBars,
|
|
||||||
approvedMultiplier //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Specified Bar is Engulfed Bar or not ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsEngulfedBar(
|
|
||||||
XOHCL &bar,
|
|
||||||
ENUM_X_DIRECTION &dir //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return patternDetector.IsEngulfedBar(
|
|
||||||
bar,
|
|
||||||
dir //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Specified Bar is True Gapped Bar or not ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
|
||||||
* @param approvedPointMultiplier: double, Gap Validation Multiplier in Point ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsTrueGapedBar(
|
|
||||||
XOHCL &bar,
|
|
||||||
ENUM_X_DIRECTION &dir,
|
|
||||||
double approvedPointMultiplier = 1 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return patternDetector.IsTrueGapedBar(
|
|
||||||
bar,
|
|
||||||
dir,
|
|
||||||
approvedPointMultiplier //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Specified Bar is Pinned Bar or not ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
|
||||||
* @param shadowApprovedMultiplier: int, Shadow Size Approve Multiplier ...
|
|
||||||
* @param minimumPinBarRangeMultiplier: doubble, Range Size Approve Multiplier in Point ...
|
|
||||||
* @param forceDirection: bool, Apply Force Bar Type ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsPinnedBar(
|
|
||||||
XOHCL &bar,
|
|
||||||
ENUM_X_DIRECTION &dir,
|
|
||||||
int shadowApprovedMultiplier = 3,
|
|
||||||
double minimumPinBarRangeMultiplier = 4,
|
|
||||||
bool forceDirection = false //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return patternDetector.IsPinnedBar(
|
|
||||||
bar,
|
|
||||||
dir,
|
|
||||||
shadowApprovedMultiplier,
|
|
||||||
minimumPinBarRangeMultiplier,
|
|
||||||
forceDirection //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Specified Bar has Star Pattern or not ...
|
|
||||||
* Morning Star => Bullish
|
|
||||||
* Evening Star => Bearish
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsStartPattern(
|
|
||||||
XOHCL &bar,
|
|
||||||
ENUM_X_DIRECTION &dir //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return patternDetector.IsStartPattern(
|
|
||||||
bar,
|
|
||||||
dir //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Specified Bar has Pirecing Pattern or not ...
|
|
||||||
* Piercing => Bullish
|
|
||||||
* Dark Cloud Cover => Bearish
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsPiercingPattern(
|
|
||||||
XOHCL &bar,
|
|
||||||
ENUM_X_DIRECTION &dir //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return patternDetector.IsPiercingPattern(
|
|
||||||
bar,
|
|
||||||
dir //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Specified Bar has Rising Pattern or not ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsRisingPattern(
|
|
||||||
XOHCL &bar,
|
|
||||||
ENUM_X_DIRECTION &dir //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return patternDetector.IsRisingPattern(
|
|
||||||
bar,
|
|
||||||
dir //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Specified Bar has Flag Pattern or not ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
|
||||||
* @param swingBar: XOHCL, Detected Swing Bar ...
|
|
||||||
* @param minimumPullbackBars: int, Minimum Shoulders of Swing Bar ...
|
|
||||||
* @param minimumPullbackBars: int, Minimum Shoulders of Swing Bar ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsFlagPattern(
|
|
||||||
XOHCL &bar,
|
|
||||||
ENUM_X_DIRECTION &dir,
|
|
||||||
XOHCL &swingBar,
|
|
||||||
int minimumPullbackBars = 3 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return patternDetector.IsFlagPattern(
|
|
||||||
bar,
|
|
||||||
dir,
|
|
||||||
swingBar,
|
|
||||||
minimumPullbackBars //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Specified Bar has SignalKey Bar Pattern or not ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
|
||||||
* @param shadowApprovedMultiplier: int, Shadow Size Approve Multiplier ...
|
|
||||||
* @param minimumPinBarRangeMultiplier: doubble, Range Size Approve Multiplier in Point ...
|
|
||||||
* @param forceDirection: bool, Apply Force Bar Type ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsSignalKeyBarPattern(
|
|
||||||
XOHCL &bar,
|
|
||||||
ENUM_X_DIRECTION &dir,
|
|
||||||
int shadowApprovedMultiplier = 3,
|
|
||||||
double minimumPinBarRangeMultiplier = 4,
|
|
||||||
bool forceDirection = false //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return patternDetector.IsSignalKeyBarPattern(
|
|
||||||
bar,
|
|
||||||
dir,
|
|
||||||
shadowApprovedMultiplier,
|
|
||||||
minimumPinBarRangeMultiplier,
|
|
||||||
forceDirection //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check For FVG Exists in Specified Loopback Period ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
|
||||||
* @param fvg: XBoxZone, reference for Holding FVG ...
|
|
||||||
* @param maxLoopback: int, Max Allowed Loopback to Lookup FVG ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool HasFVG(
|
|
||||||
XOHCL &bar,
|
|
||||||
ENUM_X_DIRECTION &dir,
|
|
||||||
XBoxZone &fvg,
|
|
||||||
int maxLoopback = 5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return patternDetector.HasFVG(
|
|
||||||
bar,
|
|
||||||
dir,
|
|
||||||
fvg,
|
|
||||||
maxLoopback //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check For OB Exists in Specified Loopback Period ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
|
||||||
* @param ob: XBoxZone, reference for Holding OB ...
|
|
||||||
* @param maxLoopback: int, Max Allowed Loopback to Lookup OB ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool HasOB(
|
|
||||||
XOHCL &bar,
|
|
||||||
ENUM_X_DIRECTION &dir,
|
|
||||||
XBoxZone &ob,
|
|
||||||
int maxLoopback = 5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return patternDetector.HasOB(
|
|
||||||
bar,
|
|
||||||
dir,
|
|
||||||
ob,
|
|
||||||
maxLoopback //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Trend Exists Based on Swings ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
|
||||||
* @param dir: ENUM_X_DIRECTION a reference for Direction ...
|
|
||||||
* @param swings: XOHCL Array, Holds Swings ...
|
|
||||||
* @param numberOfSwings: int, Number of Swing Points for Detect Trend ...
|
|
||||||
* @param swingShoulders: int, Swing Shoulders Approvement Length ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool HasSwingTrend(
|
|
||||||
XOHCL &bar,
|
|
||||||
ENUM_X_DIRECTION &dir,
|
|
||||||
XOHCL &swings[],
|
|
||||||
int numberOfSwings = 3,
|
|
||||||
int swingShoulders = 7 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return patternDetector.HasSwingTrend(
|
|
||||||
bar,
|
|
||||||
dir,
|
|
||||||
swings,
|
|
||||||
numberOfSwings,
|
|
||||||
swingShoulders //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Specified Bar Has Support or not ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
|
||||||
* @param support: XOHCL, Supported Bar ...
|
|
||||||
* @param validationLength: int, Validation Length ...
|
|
||||||
* @param maxAllowedLoopback: int, Max Allowed Loopback to Detection ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool HasSupport(
|
|
||||||
XOHCL &bar,
|
|
||||||
XOHCL &support,
|
|
||||||
int validationLength = 21,
|
|
||||||
int maxAllowedLoopback = 1500 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return patternDetector.HasSupport(
|
|
||||||
bar,
|
|
||||||
support,
|
|
||||||
validationLength,
|
|
||||||
maxAllowedLoopback //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Specified Bar Has Resistance or not ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL, Specified Bar ...
|
|
||||||
* @param resistence: XOHCL, Resistanced Bar ...
|
|
||||||
* @param validationLength: int, Validation Length ...
|
|
||||||
* @param maxAllowedLoopback: int, Max Allowed Loopback to Detection ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool HasResistance(
|
|
||||||
XOHCL &bar,
|
|
||||||
XOHCL &resistence,
|
|
||||||
int validationLength = 21,
|
|
||||||
int maxAllowedLoopback = 1500 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return patternDetector.HasResistance(
|
|
||||||
bar,
|
|
||||||
resistence,
|
|
||||||
validationLength,
|
|
||||||
maxAllowedLoopback //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
|
|
||||||
@@ -647,10 +338,6 @@ class XCXFIMAPOIDetector : public XCBase
|
|||||||
//
|
//
|
||||||
delete barAnalyser;
|
delete barAnalyser;
|
||||||
ZeroMemory(barAnalyser);
|
ZeroMemory(barAnalyser);
|
||||||
|
|
||||||
//
|
|
||||||
delete patternDetector;
|
|
||||||
ZeroMemory(patternDetector);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -0,0 +1,141 @@
|
|||||||
|
///////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 DrawZigZagMarketAnalysis(
|
||||||
|
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.Create(
|
||||||
|
ChartIdentification(),
|
||||||
|
SubWindowIdentification(),
|
||||||
|
model,
|
||||||
|
numberOfPivots //
|
||||||
|
);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Apply Style ...
|
||||||
|
bool isBullish = model.IsBullish();
|
||||||
|
|
||||||
|
//
|
||||||
|
XPOIStyle style;
|
||||||
|
if (isBullish)
|
||||||
|
{
|
||||||
|
style = defaultBullishStyle;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
style = defaultBearishStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ApplyZigZagMarketAnalysisStyle(
|
||||||
|
object,
|
||||||
|
style,
|
||||||
|
false, // Ray Right ...
|
||||||
|
true // 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user