last ...
This commit is contained in:
@@ -559,7 +559,7 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
||||
//
|
||||
XBarTracker mBarTracker; // Strategy Time Tracker ...
|
||||
XCBarAnalyser mBarAnalyser; // Bar Analyser Instance
|
||||
X121SMCStrategyConditions mConditions; // Market Conditions ...
|
||||
// X121SMCStrategyConditions mConditions; // Market Conditions ...
|
||||
|
||||
//
|
||||
// Actions ...
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
//
|
||||
// Imports ...
|
||||
#include "../../Classes/x-saherelm.base.class.mq5"
|
||||
#include "../../Helpers/x-saherelm.xpv.helper.mq5"
|
||||
#include "../../Helpers/x-saherelm.x3ma.helper.mq5"
|
||||
#include "../../Helpers/x-saherelm.x3vwap.helper.mq5"
|
||||
#include "../../Libraries/x-saherelm.common.lib.mq5"
|
||||
#include "../../Libraries/x-saherelm.x-poi.lib.mq5"
|
||||
#include "../../Libraries/x-saherelm.x-trade.lib.mq5"
|
||||
@@ -40,6 +43,11 @@ struct X121SMCStrategyConditions
|
||||
ENUM_TIMEFRAMES period;
|
||||
datetime time;
|
||||
|
||||
//
|
||||
XPVConditions xpvConditions;
|
||||
X3MAConditions x3maConditions;
|
||||
X3VWAPConditions x3vwapConditions;
|
||||
|
||||
//
|
||||
// D1 ...
|
||||
|
||||
@@ -150,6 +158,11 @@ struct X121SMCStrategyConditions
|
||||
period = NULL;
|
||||
time = NULL;
|
||||
|
||||
//
|
||||
xpvConditions.Clean();
|
||||
x3maConditions.Clean();
|
||||
x3vwapConditions.Clean();
|
||||
|
||||
//
|
||||
// D1 ...
|
||||
|
||||
|
||||
@@ -174,9 +174,53 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
conditions.symbol = _symbol;
|
||||
conditions.period = _period;
|
||||
conditions.time = TimeCurrent();
|
||||
|
||||
//
|
||||
int conditionsLoopback = 7;
|
||||
|
||||
//
|
||||
// XPV ...
|
||||
result = xpvHelper.GetConditions(
|
||||
conditions.xpvConditions,
|
||||
cIndex,
|
||||
conditionsLoopback //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// X3MA ...
|
||||
result = x3maHelper.GetConditions(
|
||||
conditions.x3maConditions,
|
||||
cIndex,
|
||||
conditionsLoopback //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// X3VWAP ...
|
||||
result = x3vwapHelper.GetConditions(
|
||||
conditions.x3vwapConditions,
|
||||
cIndex,
|
||||
conditionsLoopback //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Try to Implement SMC Based Conditions ...
|
||||
result = DetectConditions();
|
||||
result = DetectConditions(conditions);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
@@ -320,140 +364,120 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool DetectConditions()
|
||||
bool DetectConditions(
|
||||
X121SMCStrategyConditions &conditions //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
mConditions.Clean();
|
||||
mConditions.symbol = GetSymbol();
|
||||
mConditions.period = GetPeriod();
|
||||
mConditions.time = TimeCurrent();
|
||||
|
||||
//
|
||||
// Detect Market Structures ...
|
||||
|
||||
//
|
||||
// 1D ...
|
||||
mConditions.d1State = _1DState;
|
||||
conditions.d1State = _1DState;
|
||||
result = DetectMarketStructure(
|
||||
mConditions.d1MarketDirection,
|
||||
mConditions.d1SupportZones,
|
||||
mConditions.d1ResistanceZones,
|
||||
conditions.d1MarketDirection,
|
||||
conditions.d1SupportZones,
|
||||
conditions.d1ResistanceZones,
|
||||
_1DState //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// 4H ...
|
||||
mConditions.h4State = _4HState;
|
||||
conditions.h4State = _4HState;
|
||||
result = DetectMarketStructure(
|
||||
mConditions.h4MarketDirection,
|
||||
mConditions.h4SupportZones,
|
||||
mConditions.h4ResistanceZones,
|
||||
conditions.h4MarketDirection,
|
||||
conditions.h4SupportZones,
|
||||
conditions.h4ResistanceZones,
|
||||
_4HState //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// 2H ...
|
||||
mConditions.h2State = _2HState;
|
||||
conditions.h2State = _2HState;
|
||||
result = DetectMarketStructure(
|
||||
mConditions.h2MarketDirection,
|
||||
mConditions.h2SupportZones,
|
||||
mConditions.h2ResistanceZones,
|
||||
conditions.h2MarketDirection,
|
||||
conditions.h2SupportZones,
|
||||
conditions.h2ResistanceZones,
|
||||
_2HState //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// 1H ...
|
||||
mConditions.h1State = _1HState;
|
||||
conditions.h1State = _1HState;
|
||||
result = DetectMarketStructure(
|
||||
mConditions.h1MarketDirection,
|
||||
mConditions.h1SupportZones,
|
||||
mConditions.h1ResistanceZones,
|
||||
conditions.h1MarketDirection,
|
||||
conditions.h1SupportZones,
|
||||
conditions.h1ResistanceZones,
|
||||
_1HState //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// 15M ...
|
||||
mConditions.m15State = _15MState;
|
||||
conditions.m15State = _15MState;
|
||||
result = DetectMarketStructure(
|
||||
mConditions.m15MarketDirection,
|
||||
mConditions.m15SupportZones,
|
||||
mConditions.m15ResistanceZones,
|
||||
conditions.m15MarketDirection,
|
||||
conditions.m15SupportZones,
|
||||
conditions.m15ResistanceZones,
|
||||
_15MState //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// 5M ...
|
||||
mConditions.m5State = _5MState;
|
||||
conditions.m5State = _5MState;
|
||||
result = DetectMarketStructure(
|
||||
mConditions.m5MarketDirection,
|
||||
mConditions.m5SupportZones,
|
||||
mConditions.m5ResistanceZones,
|
||||
conditions.m5MarketDirection,
|
||||
conditions.m5SupportZones,
|
||||
conditions.m5ResistanceZones,
|
||||
_5MState //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// 1M ...
|
||||
mConditions.m1State = _1MState;
|
||||
conditions.m1State = _1MState;
|
||||
result = DetectMarketStructure(
|
||||
mConditions.m1MarketDirection,
|
||||
mConditions.m1SupportZones,
|
||||
mConditions.m1ResistanceZones,
|
||||
conditions.m1MarketDirection,
|
||||
conditions.m1SupportZones,
|
||||
conditions.m1ResistanceZones,
|
||||
_1MState //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// 1H-15M-5M ...
|
||||
ENUM_X_DIRECTION marketStructure = X_DIRECTION_NONE;
|
||||
result = mConditions.HasMarketStructure(marketStructure);
|
||||
result = conditions.HasMarketStructure(marketStructure);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
mConditions.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -472,14 +496,14 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
XCResistanceZone *h1ResistanceZone = NULL;
|
||||
|
||||
//
|
||||
count = ArraySize(mConditions.h1SupportZones);
|
||||
count = ArraySize(conditions.h1SupportZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSupportZone *item = mConditions.h1SupportZones[i];
|
||||
XCSupportZone *item = conditions.h1SupportZones[i];
|
||||
|
||||
//
|
||||
bool canSelect =
|
||||
@@ -495,7 +519,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
{
|
||||
//
|
||||
// Detect Swings ...
|
||||
count = ArraySize(mConditions.h1State.swingLows);
|
||||
count = ArraySize(conditions.h1State.swingLows);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
@@ -506,7 +530,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSwing *item = mConditions.h1State.swingLows[i];
|
||||
XCSwing *item = conditions.h1State.swingLows[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
@@ -558,14 +582,14 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
}
|
||||
|
||||
//
|
||||
count = ArraySize(mConditions.h1ResistanceZones);
|
||||
count = ArraySize(conditions.h1ResistanceZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCResistanceZone *item = mConditions.h1ResistanceZones[i];
|
||||
XCResistanceZone *item = conditions.h1ResistanceZones[i];
|
||||
|
||||
//
|
||||
bool canSelect =
|
||||
@@ -581,7 +605,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
{
|
||||
//
|
||||
// Detect Swings ...
|
||||
count = ArraySize(mConditions.h1State.swingHighs);
|
||||
count = ArraySize(conditions.h1State.swingHighs);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
@@ -592,7 +616,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSwing *item = mConditions.h1State.swingHighs[i];
|
||||
XCSwing *item = conditions.h1State.swingHighs[i];
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
@@ -648,14 +672,14 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
XCSupportZone *m15SupportZone = NULL;
|
||||
count = ArraySize(mConditions.m15SupportZones);
|
||||
count = ArraySize(conditions.m15SupportZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSupportZone *item = mConditions.m15SupportZones[i];
|
||||
XCSupportZone *item = conditions.m15SupportZones[i];
|
||||
|
||||
//
|
||||
bool canSelect =
|
||||
@@ -683,14 +707,14 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
XCResistanceZone *m15ResistanceZone = NULL;
|
||||
count = ArraySize(mConditions.m15ResistanceZones);
|
||||
count = ArraySize(conditions.m15ResistanceZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCResistanceZone *item = mConditions.m15ResistanceZones[i];
|
||||
XCResistanceZone *item = conditions.m15ResistanceZones[i];
|
||||
|
||||
//
|
||||
bool canSelect =
|
||||
@@ -721,14 +745,14 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
XCSupportZone *m5SupportZone = NULL;
|
||||
count = ArraySize(mConditions.m5SupportZones);
|
||||
count = ArraySize(conditions.m5SupportZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCSupportZone *item = mConditions.m5SupportZones[i];
|
||||
XCSupportZone *item = conditions.m5SupportZones[i];
|
||||
|
||||
//
|
||||
bool canSelect =
|
||||
@@ -756,14 +780,14 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
XCResistanceZone *m5ResistanceZone = NULL;
|
||||
count = ArraySize(mConditions.m5ResistanceZones);
|
||||
count = ArraySize(conditions.m5ResistanceZones);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCResistanceZone *item = mConditions.m5ResistanceZones[i];
|
||||
XCResistanceZone *item = conditions.m5ResistanceZones[i];
|
||||
|
||||
//
|
||||
bool canSelect =
|
||||
@@ -1038,23 +1062,23 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
// Short ...
|
||||
ENUM_X_PERIOD_METHOD scMethod = X_PERIOD_AUTO; // How to Find Period
|
||||
ENUM_TIMEFRAMES scPeriod = NULL; // Time Period
|
||||
ENUM_X_PERIOD_METHOD scMethod = X_PERIOD_MANUALLY; // How to Find Period
|
||||
ENUM_TIMEFRAMES scPeriod = PERIOD_M15; // Time Period
|
||||
|
||||
//
|
||||
// Medium ...
|
||||
ENUM_X_PERIOD_METHOD mcMethod = X_PERIOD_AUTO; // How to Find Period
|
||||
ENUM_TIMEFRAMES mcPeriod = NULL; // Time Period
|
||||
ENUM_X_PERIOD_METHOD mcMethod = X_PERIOD_MANUALLY; // How to Find Period
|
||||
ENUM_TIMEFRAMES mcPeriod = PERIOD_M30; // Time Period
|
||||
|
||||
//
|
||||
// Long ...
|
||||
ENUM_X_PERIOD_METHOD lcMethod = X_PERIOD_AUTO; // How to Find Period
|
||||
ENUM_TIMEFRAMES lcPeriod = NULL; // Time Period
|
||||
ENUM_X_PERIOD_METHOD lcMethod = X_PERIOD_MANUALLY; // How to Find Period
|
||||
ENUM_TIMEFRAMES lcPeriod = PERIOD_H1; // Time Period
|
||||
|
||||
//
|
||||
// Hind ...
|
||||
ENUM_X_PERIOD_METHOD hcMethod = X_PERIOD_AUTO; // How to Find Period
|
||||
ENUM_TIMEFRAMES hcPeriod = NULL; // Time Period
|
||||
ENUM_X_PERIOD_METHOD hcMethod = X_PERIOD_MANUALLY; // How to Find Period
|
||||
ENUM_TIMEFRAMES hcPeriod = PERIOD_H2; // Time Period
|
||||
|
||||
//
|
||||
// XPV ...
|
||||
|
||||
Reference in New Issue
Block a user