cleanup workspace and backup unused strategies ...
This commit is contained in:
@@ -36,10 +36,7 @@ const string X121SMCStrategyToken = "X121SMC";
|
||||
|
||||
//
|
||||
const string X121SMCXToken = "X121X";
|
||||
const string X121SMCXPZToken = "X121XPZ";
|
||||
const string X121SMCXPVTToken = "X121XPVT";
|
||||
const string X121SMCXRSPVIToken = "X121XRSPVI";
|
||||
const string X121SMCXSTRPVToken = "X121XSTRPV";
|
||||
const string X121SMCXOBPVToken = "X121XOBPV";
|
||||
|
||||
//
|
||||
// X121 SMC Providers ...
|
||||
@@ -48,10 +45,7 @@ enum ENUM_X_121_SMC_PROVIDERS
|
||||
//
|
||||
X_121_SMC_PROVIDER_NONE,
|
||||
X_121_SMC_PROVIDER_X,
|
||||
X_121_SMC_PROVIDER_XPZ,
|
||||
X_121_SMC_PROVIDER_XPVT,
|
||||
X_121_SMC_PROVIDER_XRSPVI,
|
||||
X_121_SMC_PROVIDER_XSTRPV,
|
||||
X_121_SMC_PROVIDER_XOBPV,
|
||||
};
|
||||
|
||||
//
|
||||
@@ -711,23 +705,8 @@ string ToString(ENUM_X_121_SMC_PROVIDERS value)
|
||||
break;
|
||||
|
||||
//
|
||||
case X_121_SMC_PROVIDER_XPZ:
|
||||
result = X121SMCXPZToken;
|
||||
break;
|
||||
|
||||
//
|
||||
case X_121_SMC_PROVIDER_XPVT:
|
||||
result = X121SMCXPVTToken;
|
||||
break;
|
||||
|
||||
//
|
||||
case X_121_SMC_PROVIDER_XRSPVI:
|
||||
result = X121SMCXRSPVIToken;
|
||||
break;
|
||||
|
||||
//
|
||||
case X_121_SMC_PROVIDER_XSTRPV:
|
||||
result = X121SMCXSTRPVToken;
|
||||
case X_121_SMC_PROVIDER_XOBPV:
|
||||
result = X121SMCXOBPVToken;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -758,21 +737,9 @@ ENUM_X_121_SMC_PROVIDERS ParseProvider(string value)
|
||||
{
|
||||
result = X_121_SMC_PROVIDER_X;
|
||||
}
|
||||
else if (Contains(X121SMCXPZToken, value))
|
||||
else if (Contains(X121SMCXOBPVToken, value))
|
||||
{
|
||||
result = X_121_SMC_PROVIDER_XPZ;
|
||||
}
|
||||
else if (Contains(X121SMCXPVTToken, value))
|
||||
{
|
||||
result = X_121_SMC_PROVIDER_XPVT;
|
||||
}
|
||||
else if (Contains(X121SMCXRSPVIToken, value))
|
||||
{
|
||||
result = X_121_SMC_PROVIDER_XRSPVI;
|
||||
}
|
||||
else if (Contains(X121SMCXSTRPVToken, value))
|
||||
{
|
||||
result = X_121_SMC_PROVIDER_XSTRPV;
|
||||
result = X_121_SMC_PROVIDER_XOBPV;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -219,7 +219,7 @@ X121SMCStrategyXSignalConditions mXConditionsCollection[];
|
||||
|
||||
//
|
||||
// Detect Setup Conditions ...
|
||||
bool DetectX121SMCXSiganlSetup(
|
||||
bool DetectX121SMCXSignalSetup(
|
||||
string _symbol,
|
||||
ENUM_TIMEFRAMES _period,
|
||||
//
|
||||
@@ -1310,7 +1310,7 @@ bool DetectX121SMCXSiganlSetup(
|
||||
|
||||
//
|
||||
// Detect Trigger Conditions ...
|
||||
bool DetectX121SMCXSiganlTrigger(
|
||||
bool DetectX121SMCXSignalTrigger(
|
||||
//
|
||||
X121SMCStrategyXSignalConditions &conditions,
|
||||
//
|
||||
|
||||
+688
-664
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -28,10 +28,7 @@
|
||||
|
||||
//
|
||||
#include "../Signals/x-121.smc.x.signal.lib.mq5"
|
||||
#include "../Signals/x-121.smc.xpvt.signal.lib.mq5"
|
||||
#include "../Signals/x-121.smc.xpz.signal.lib.mq5"
|
||||
#include "../Signals/x-121.smc.xrspvi.signal.lib.mq5"
|
||||
#include "../Signals/x-121.smc.xstrpv.signal.lib.mq5"
|
||||
#include "../Signals/x-121.smc.xobpv.signal.lib.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
@@ -46,10 +43,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
// Props ...
|
||||
bool useXSignal;
|
||||
bool useXPZSignal;
|
||||
bool useXPVTSignal;
|
||||
bool useXRSPVISignal;
|
||||
bool useXSTRPVSignal;
|
||||
bool useXOBPVSignal;
|
||||
|
||||
//
|
||||
// Constructor(s) ...
|
||||
@@ -72,9 +66,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
Destroy();
|
||||
|
||||
//
|
||||
ArrayFree(mXPZConditionsCollection);
|
||||
ArrayFree(mXRSPVIConditionsCollection);
|
||||
ArrayFree(mXSTRPVConditionsCollection);
|
||||
ArrayFree(mXConditionsCollection);
|
||||
ArrayFree(mXOBPVConditionsCollection);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -201,10 +194,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
bool hasXSignal = false;
|
||||
bool hasXPZSignal = false;
|
||||
bool hasXPVTSignal = false;
|
||||
bool hasXRSPVISignal = false;
|
||||
bool hasXSTRPVSignal = false;
|
||||
bool hasXOBPVSignal = false;
|
||||
|
||||
//
|
||||
// X Signal ...
|
||||
@@ -216,39 +206,12 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
}
|
||||
|
||||
//
|
||||
// XPZ Signal ...
|
||||
if (useXPZSignal && !hasSignal)
|
||||
// XOBPV Signal ...
|
||||
if (useXOBPVSignal && !hasSignal)
|
||||
{
|
||||
//
|
||||
hasXPZSignal = DetectXPZSignal(conditions);
|
||||
hasSignal = hasXPZSignal;
|
||||
}
|
||||
|
||||
//
|
||||
// XPVT Signal ...
|
||||
if (useXPVTSignal && !hasSignal)
|
||||
{
|
||||
//
|
||||
hasXPVTSignal = DetectXPVTSignal(conditions);
|
||||
hasSignal = hasXPVTSignal;
|
||||
}
|
||||
|
||||
//
|
||||
// XRSPVI Signal ...
|
||||
if (useXRSPVISignal && !hasSignal)
|
||||
{
|
||||
//
|
||||
hasXRSPVISignal = DetectXRSPVISignal(conditions);
|
||||
hasSignal = hasXRSPVISignal;
|
||||
}
|
||||
|
||||
//
|
||||
// XSTRPV Signal ...
|
||||
if (useXSTRPVSignal && !hasSignal)
|
||||
{
|
||||
//
|
||||
hasXSTRPVSignal = DetectXSTRPVSignal(conditions);
|
||||
hasSignal = hasXSTRPVSignal;
|
||||
hasXOBPVSignal = DetectXOBPVSignal(conditions);
|
||||
hasSignal = hasXOBPVSignal;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -425,61 +388,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
// XPZ Guard Detection ...
|
||||
if (useXPZSignal)
|
||||
if (useXOBPVSignal)
|
||||
{
|
||||
//
|
||||
bool hasGuard = DetectX121SMCXPZGuards(
|
||||
guards,
|
||||
positions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// XPVT Guard Detection ...
|
||||
if (useXPVTSignal)
|
||||
{
|
||||
//
|
||||
bool hasGuard = DetectX121SMCXPVTGuards(
|
||||
guards,
|
||||
positions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// XSTRPV Guard Detection ...
|
||||
if (useXSTRPVSignal)
|
||||
{
|
||||
//
|
||||
bool hasGuard = DetectX121SMCXSTRPVGuards(
|
||||
guards,
|
||||
positions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// XRSPVI Guard Detection ...
|
||||
if (useXRSPVISignal)
|
||||
{
|
||||
//
|
||||
bool hasGuard = DetectX121SMCXRSPVIGuards(
|
||||
bool hasGuard = DetectX121SMCXOBPVGuards(
|
||||
guards,
|
||||
positions,
|
||||
mTriggerCycleHelper,
|
||||
@@ -608,7 +520,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
{
|
||||
//
|
||||
// Detect Signal Setup ...
|
||||
isSetuped = DetectX121SMCXSiganlSetup(
|
||||
isSetuped = DetectX121SMCXSignalSetup(
|
||||
symbol,
|
||||
period,
|
||||
mXConditions,
|
||||
@@ -682,7 +594,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
{
|
||||
//
|
||||
// Detect Signal Trigger ...
|
||||
canTrigger = DetectX121SMCXSiganlTrigger(
|
||||
canTrigger = DetectX121SMCXSignalTrigger(
|
||||
mTmpConditions[i],
|
||||
symbol,
|
||||
period,
|
||||
@@ -765,8 +677,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
}
|
||||
|
||||
//
|
||||
// XPZ Signal ...
|
||||
bool DetectXPZSignal(
|
||||
// XOBPV Signal ...
|
||||
bool DetectXOBPVSignal(
|
||||
X121SMCStrategyConditions &conditions //
|
||||
)
|
||||
{
|
||||
@@ -831,22 +743,22 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
datetime cTime = TimeCurrent();
|
||||
|
||||
//
|
||||
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XPZ;
|
||||
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XOBPV;
|
||||
string providerStr = ToString(provider);
|
||||
|
||||
//
|
||||
// Detect Setup Conditions ...
|
||||
datetime setupTime = mXPZConditions.setupTime;
|
||||
bool isSetuped = mXPZConditions.IsSetuped();
|
||||
ENUM_X_DIRECTION setupDir = mXPZConditions.dir;
|
||||
datetime setupTime = mXOBPVConditions.setupTime;
|
||||
bool isSetuped = mXOBPVConditions.IsSetuped();
|
||||
ENUM_X_DIRECTION setupDir = mXOBPVConditions.dir;
|
||||
if (!isSetuped)
|
||||
{
|
||||
//
|
||||
// Detect Signal Setup ...
|
||||
isSetuped = DetectX121SMCXPZSiganlSetup(
|
||||
isSetuped = DetectX121SMCXOBPVSignalSetup(
|
||||
symbol,
|
||||
period,
|
||||
mXPZConditions,
|
||||
mXOBPVConditions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
@@ -856,25 +768,25 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
);
|
||||
|
||||
//
|
||||
setupDir = mXPZConditions.dir;
|
||||
setupTime = mXPZConditions.setupTime;
|
||||
setupDir = mXOBPVConditions.dir;
|
||||
setupTime = mXOBPVConditions.setupTime;
|
||||
|
||||
//
|
||||
if (isSetuped)
|
||||
{
|
||||
//
|
||||
int items = AddX121SMCXPZConditionsIfNotExists(
|
||||
mXPZConditions,
|
||||
mXPZConditionsCollection //
|
||||
int items = AddX121SMCXOBPVConditionsIfNotExists(
|
||||
mXOBPVConditions,
|
||||
mXOBPVConditionsCollection //
|
||||
);
|
||||
|
||||
//
|
||||
mXPZConditions.Clean();
|
||||
mXOBPVConditions.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
int conditionsCount = ArraySize(mXPZConditionsCollection);
|
||||
int conditionsCount = ArraySize(mXOBPVConditionsCollection);
|
||||
result = IsValidSize(conditionsCount);
|
||||
if (!result)
|
||||
{
|
||||
@@ -884,12 +796,12 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
// Looking For Conditions ...
|
||||
int selectedIndex = 0;
|
||||
X121SMCStrategyXPZSignalConditions mTmpConditions[];
|
||||
X121SMCStrategyXOBPVSignalConditions mTmpConditions[];
|
||||
Copy(
|
||||
mXPZConditionsCollection,
|
||||
mXOBPVConditionsCollection,
|
||||
mTmpConditions //
|
||||
);
|
||||
X121SMCStrategyXPZSignalConditions mConditions;
|
||||
X121SMCStrategyXOBPVSignalConditions mConditions;
|
||||
for (int i = 0; i < conditionsCount; i++)
|
||||
{
|
||||
//
|
||||
@@ -900,7 +812,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
{
|
||||
//
|
||||
// Detect Signal Trigger ...
|
||||
canTrigger = DetectX121SMCXPZSiganlTrigger(
|
||||
canTrigger = DetectX121SMCXOBPVSignalTrigger(
|
||||
mTmpConditions[i],
|
||||
symbol,
|
||||
period,
|
||||
@@ -922,7 +834,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
mXPZConditionsCollection,
|
||||
mXOBPVConditionsCollection,
|
||||
i,
|
||||
1 //
|
||||
);
|
||||
@@ -955,661 +867,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
// Remove Selected Index from Main Collection ...
|
||||
ArrayRemove(
|
||||
mXPZConditionsCollection,
|
||||
selectedIndex,
|
||||
1 //
|
||||
);
|
||||
|
||||
//
|
||||
// Check Signal Direction ...
|
||||
isBullish = IsBullish(mConditions.dir);
|
||||
isBearish = IsBearish(mConditions.dir);
|
||||
result = isBullish ||
|
||||
isBearish;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Issues Signal on Conditions ...
|
||||
conditions.sl = mConditions.sl;
|
||||
conditions.provider = providerStr;
|
||||
conditions.signalDir = mConditions.dir;
|
||||
conditions.target = mConditions.target;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XPVT Signal ...
|
||||
bool DetectXPVTSignal(
|
||||
X121SMCStrategyConditions &conditions //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
bool isBullish = false;
|
||||
bool isBearish = false;
|
||||
|
||||
//
|
||||
int zIndex = 0;
|
||||
int cIndex = zIndex + 1;
|
||||
int pIndex = cIndex + 1;
|
||||
int ppIndex = pIndex + 1;
|
||||
|
||||
//
|
||||
string symbol = GetSymbol();
|
||||
ENUM_TIMEFRAMES period = GetPeriod();
|
||||
|
||||
//
|
||||
XOHCL zBar;
|
||||
result = zBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
zIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL cBar;
|
||||
result = cBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
cIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL pBar;
|
||||
result = pBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
pIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double cLL = cBar.FindLowest(7, MODE_LOW);
|
||||
double cHH = cBar.FindHighest(7, MODE_HIGH);
|
||||
|
||||
//
|
||||
datetime cTime = TimeCurrent();
|
||||
|
||||
//
|
||||
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XPVT;
|
||||
string providerStr = ToString(provider);
|
||||
|
||||
//
|
||||
// Detect Setup Conditions ...
|
||||
datetime setupTime = mXPVTConditions.setupTime;
|
||||
bool isSetuped = mXPVTConditions.IsSetuped();
|
||||
ENUM_X_DIRECTION setupDir = mXPVTConditions.dir;
|
||||
if (!isSetuped)
|
||||
{
|
||||
//
|
||||
// Detect Signal Setup ...
|
||||
isSetuped = DetectX121SMCXPVTSiganlSetup(
|
||||
symbol,
|
||||
period,
|
||||
mXPVTConditions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
setupDir = mXPVTConditions.dir;
|
||||
setupTime = mXPVTConditions.setupTime;
|
||||
|
||||
//
|
||||
if (isSetuped)
|
||||
{
|
||||
//
|
||||
int items = AddX121SMCXPVTConditionsIfNotExists(
|
||||
mXPVTConditions,
|
||||
mXPVTConditionsCollection //
|
||||
);
|
||||
|
||||
//
|
||||
mXPVTConditions.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
int conditionsCount = ArraySize(mXPVTConditionsCollection);
|
||||
result = IsValidSize(conditionsCount);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Looking For Conditions ...
|
||||
int selectedIndex = 0;
|
||||
X121SMCStrategyXPVTSignalConditions mTmpConditions[];
|
||||
Copy(
|
||||
mXPVTConditionsCollection,
|
||||
mTmpConditions //
|
||||
);
|
||||
X121SMCStrategyXPVTSignalConditions mConditions;
|
||||
for (int i = 0; i < conditionsCount; i++)
|
||||
{
|
||||
//
|
||||
// Check Triggers ...
|
||||
bool canTrigger = mTmpConditions[i].CanTrigger();
|
||||
datetime triggerTime = mTmpConditions[i].triggerTime;
|
||||
if (!canTrigger)
|
||||
{
|
||||
//
|
||||
// Detect Signal Trigger ...
|
||||
canTrigger = DetectX121SMCXPVTSiganlTrigger(
|
||||
mTmpConditions[i],
|
||||
symbol,
|
||||
period,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
result = canTrigger;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
bool isISetuped = mTmpConditions[i].IsSetuped();
|
||||
if (!isISetuped)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
mXPVTConditionsCollection,
|
||||
i,
|
||||
1 //
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
triggerTime = mTmpConditions[i].triggerTime;
|
||||
}
|
||||
|
||||
//
|
||||
if (canTrigger)
|
||||
{
|
||||
//
|
||||
selectedIndex = i;
|
||||
mConditions = mTmpConditions[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = IsValid(mConditions.setupTime) &&
|
||||
HasDirection(mConditions.dir);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Remove Selected Index from Main Collection ...
|
||||
ArrayRemove(
|
||||
mXPVTConditionsCollection,
|
||||
selectedIndex,
|
||||
1 //
|
||||
);
|
||||
|
||||
//
|
||||
// Check Signal Direction ...
|
||||
isBullish = IsBullish(mConditions.dir);
|
||||
isBearish = IsBearish(mConditions.dir);
|
||||
result = isBullish ||
|
||||
isBearish;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Issues Signal on Conditions ...
|
||||
conditions.sl = mConditions.sl;
|
||||
conditions.provider = providerStr;
|
||||
conditions.signalDir = mConditions.dir;
|
||||
conditions.target = mConditions.target;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XSTRPV Signal ...
|
||||
bool DetectXSTRPVSignal(
|
||||
X121SMCStrategyConditions &conditions //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
bool isBullish = false;
|
||||
bool isBearish = false;
|
||||
|
||||
//
|
||||
int zIndex = 0;
|
||||
int cIndex = zIndex + 1;
|
||||
int pIndex = cIndex + 1;
|
||||
int ppIndex = pIndex + 1;
|
||||
|
||||
//
|
||||
string symbol = GetSymbol();
|
||||
ENUM_TIMEFRAMES period = GetPeriod();
|
||||
|
||||
//
|
||||
XOHCL zBar;
|
||||
result = zBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
zIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL cBar;
|
||||
result = cBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
cIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL pBar;
|
||||
result = pBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
pIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double cLL = cBar.FindLowest(7, MODE_LOW);
|
||||
double cHH = cBar.FindHighest(7, MODE_HIGH);
|
||||
|
||||
//
|
||||
datetime cTime = TimeCurrent();
|
||||
|
||||
//
|
||||
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XSTRPV;
|
||||
string providerStr = ToString(provider);
|
||||
|
||||
//
|
||||
// Detect Setup Conditions ...
|
||||
datetime setupTime = mXSTRPVConditions.setupTime;
|
||||
bool isSetuped = mXSTRPVConditions.IsSetuped();
|
||||
ENUM_X_DIRECTION setupDir = mXSTRPVConditions.dir;
|
||||
if (!isSetuped)
|
||||
{
|
||||
//
|
||||
// Detect Signal Setup ...
|
||||
isSetuped = DetectX121SMCXSTRPVSiganlSetup(
|
||||
symbol,
|
||||
period,
|
||||
mXSTRPVConditions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
setupDir = mXSTRPVConditions.dir;
|
||||
setupTime = mXSTRPVConditions.setupTime;
|
||||
|
||||
//
|
||||
if (isSetuped)
|
||||
{
|
||||
//
|
||||
int items = AddX121SMCXSTRPVConditionsIfNotExists(
|
||||
mXSTRPVConditions,
|
||||
mXSTRPVConditionsCollection //
|
||||
);
|
||||
|
||||
//
|
||||
mXSTRPVConditions.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
int conditionsCount = ArraySize(mXSTRPVConditionsCollection);
|
||||
result = IsValidSize(conditionsCount);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Looking For Conditions ...
|
||||
int selectedIndex = 0;
|
||||
X121SMCStrategyXSTRPVSignalConditions mTmpConditions[];
|
||||
Copy(
|
||||
mXSTRPVConditionsCollection,
|
||||
mTmpConditions //
|
||||
);
|
||||
X121SMCStrategyXSTRPVSignalConditions mConditions;
|
||||
for (int i = 0; i < conditionsCount; i++)
|
||||
{
|
||||
//
|
||||
// Check Triggers ...
|
||||
bool canTrigger = mTmpConditions[i].CanTrigger();
|
||||
datetime triggerTime = mTmpConditions[i].triggerTime;
|
||||
if (!canTrigger)
|
||||
{
|
||||
//
|
||||
// Detect Signal Trigger ...
|
||||
canTrigger = DetectX121SMCXSTRPVSiganlTrigger(
|
||||
mTmpConditions[i],
|
||||
symbol,
|
||||
period,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
result = canTrigger;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
bool isISetuped = mTmpConditions[i].IsSetuped();
|
||||
if (!isISetuped)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
mXSTRPVConditionsCollection,
|
||||
i,
|
||||
1 //
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
triggerTime = mTmpConditions[i].triggerTime;
|
||||
}
|
||||
|
||||
//
|
||||
if (canTrigger)
|
||||
{
|
||||
//
|
||||
selectedIndex = i;
|
||||
mConditions = mTmpConditions[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = IsValid(mConditions.setupTime) &&
|
||||
HasDirection(mConditions.dir);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Remove Selected Index from Main Collection ...
|
||||
ArrayRemove(
|
||||
mXSTRPVConditionsCollection,
|
||||
selectedIndex,
|
||||
1 //
|
||||
);
|
||||
|
||||
//
|
||||
// Check Signal Direction ...
|
||||
isBullish = IsBullish(mConditions.dir);
|
||||
isBearish = IsBearish(mConditions.dir);
|
||||
result = isBullish ||
|
||||
isBearish;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Issues Signal on Conditions ...
|
||||
conditions.sl = mConditions.sl;
|
||||
conditions.provider = providerStr;
|
||||
conditions.signalDir = mConditions.dir;
|
||||
conditions.target = mConditions.target;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XRSPVI Signal ...
|
||||
bool DetectXRSPVISignal(
|
||||
X121SMCStrategyConditions &conditions //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
bool isBullish = false;
|
||||
bool isBearish = false;
|
||||
|
||||
//
|
||||
int zIndex = 0;
|
||||
int cIndex = zIndex + 1;
|
||||
int pIndex = cIndex + 1;
|
||||
int ppIndex = pIndex + 1;
|
||||
|
||||
//
|
||||
string symbol = GetSymbol();
|
||||
ENUM_TIMEFRAMES period = GetPeriod();
|
||||
|
||||
//
|
||||
XOHCL zBar;
|
||||
result = zBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
zIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL cBar;
|
||||
result = cBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
cIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL pBar;
|
||||
result = pBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
pIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double cLL = cBar.FindLowest(7, MODE_LOW);
|
||||
double cHH = cBar.FindHighest(7, MODE_HIGH);
|
||||
|
||||
//
|
||||
datetime cTime = TimeCurrent();
|
||||
|
||||
//
|
||||
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XRSPVI;
|
||||
string providerStr = ToString(provider);
|
||||
|
||||
//
|
||||
// Detect Setup Conditions ...
|
||||
datetime setupTime = mXRSPVIConditions.setupTime;
|
||||
bool isSetuped = mXRSPVIConditions.IsSetuped();
|
||||
ENUM_X_DIRECTION setupDir = mXRSPVIConditions.dir;
|
||||
if (!isSetuped)
|
||||
{
|
||||
//
|
||||
// Detect Signal Setup ...
|
||||
isSetuped = DetectX121SMCXRSPVISiganlSetup(
|
||||
symbol,
|
||||
period,
|
||||
mXRSPVIConditions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
setupDir = mXRSPVIConditions.dir;
|
||||
setupTime = mXRSPVIConditions.setupTime;
|
||||
|
||||
//
|
||||
if (isSetuped)
|
||||
{
|
||||
//
|
||||
int items = AddX121SMCXRSPVIConditionsIfNotExists(
|
||||
mXRSPVIConditions,
|
||||
mXRSPVIConditionsCollection //
|
||||
);
|
||||
|
||||
//
|
||||
mXRSPVIConditions.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
int conditionsCount = ArraySize(mXRSPVIConditionsCollection);
|
||||
result = IsValidSize(conditionsCount);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Looking For Conditions ...
|
||||
int selectedIndex = 0;
|
||||
X121SMCStrategyXRSPVISignalConditions mTmpConditions[];
|
||||
Copy(
|
||||
mXRSPVIConditionsCollection,
|
||||
mTmpConditions //
|
||||
);
|
||||
X121SMCStrategyXRSPVISignalConditions mConditions;
|
||||
for (int i = 0; i < conditionsCount; i++)
|
||||
{
|
||||
//
|
||||
// Check Triggers ...
|
||||
bool canTrigger = mTmpConditions[i].CanTrigger();
|
||||
datetime triggerTime = mTmpConditions[i].triggerTime;
|
||||
if (!canTrigger)
|
||||
{
|
||||
//
|
||||
// Detect Signal Trigger ...
|
||||
canTrigger = DetectX121SMCXRSPVISiganlTrigger(
|
||||
mTmpConditions[i],
|
||||
symbol,
|
||||
period,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
result = canTrigger;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
bool isISetuped = mTmpConditions[i].IsSetuped();
|
||||
if (!isISetuped)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
mXRSPVIConditionsCollection,
|
||||
i,
|
||||
1 //
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
triggerTime = mTmpConditions[i].triggerTime;
|
||||
}
|
||||
|
||||
//
|
||||
if (canTrigger)
|
||||
{
|
||||
//
|
||||
selectedIndex = i;
|
||||
mConditions = mTmpConditions[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = IsValid(mConditions.setupTime) &&
|
||||
HasDirection(mConditions.dir);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Remove Selected Index from Main Collection ...
|
||||
ArrayRemove(
|
||||
mXRSPVIConditionsCollection,
|
||||
mXOBPVConditionsCollection,
|
||||
selectedIndex,
|
||||
1 //
|
||||
);
|
||||
@@ -1651,11 +909,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
void InitialHelpers()
|
||||
{
|
||||
//
|
||||
useXSignal = true;
|
||||
useXPZSignal = false;
|
||||
useXPVTSignal = false;
|
||||
useXRSPVISignal = false;
|
||||
useXSTRPVSignal = false;
|
||||
useXSignal = false;
|
||||
useXOBPVSignal = true;
|
||||
|
||||
//
|
||||
string symbol = GetSymbol();
|
||||
|
||||
Reference in New Issue
Block a user