This commit is contained in:
2025-01-21 05:46:01 +03:30
parent 6363320cc2
commit 560a54af30
16 changed files with 7623 additions and 859 deletions
+281 -33
View File
@@ -27,6 +27,7 @@
#include "../Classes/x-121.smc.market.cycle.helper.class.mq5"
//
#include "../Signals/x-121.smc.x.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"
@@ -43,6 +44,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
public:
//
// Props ...
bool useXSignal;
bool useXPZSignal;
bool useXRSPVISignal;
bool useXSTRPVSignal;
@@ -195,10 +197,20 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
bool hasSignal = false;
//
bool hasXSignal = false;
bool hasXPZSignal = false;
bool hasXRSPVISignal = false;
bool hasXSTRPVSignal = false;
//
// X Signal ...
if (useXSignal && !hasSignal)
{
//
hasXSignal = DetectXSignal(conditions);
hasSignal = hasXSignal;
}
//
// XPZ Signal ...
if (useXPZSignal && !hasSignal)
@@ -382,11 +394,11 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
}
//
// XSTRPV Guard Detection ...
if (useXSTRPVSignal)
// X Guard Detection ...
if (useXSignal)
{
//
bool hasGuard = DetectX121SMCXSTRPVGuards(
bool hasGuard = DetectX121SMCXGuards(
guards,
positions,
mTriggerCycleHelper,
@@ -415,6 +427,23 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
);
}
//
// XSTRPV Guard Detection ...
if (useXSTRPVSignal)
{
//
bool hasGuard = DetectX121SMCXSTRPVGuards(
guards,
positions,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
}
//
// XRSPVI Guard Detection ...
if (useXRSPVISignal)
@@ -471,8 +500,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// Signalling Functions ...
//
// XSTRPV Signal ...
bool DetectXSTRPVSignal(
// X Signal ...
bool DetectXSignal(
X121SMCStrategyConditions &conditions //
)
{
@@ -537,22 +566,22 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
datetime cTime = TimeCurrent();
//
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XSTRPV;
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_X;
string providerStr = ToString(provider);
//
// Detect Setup Conditions ...
datetime setupTime = mXSTRPVConditions.setupTime;
bool isSetuped = mXSTRPVConditions.IsSetuped();
ENUM_X_DIRECTION setupDir = mXSTRPVConditions.dir;
datetime setupTime = mXConditions.setupTime;
bool isSetuped = mXConditions.IsSetuped();
ENUM_X_DIRECTION setupDir = mXConditions.dir;
if (!isSetuped)
{
//
// Detect Signal Setup ...
isSetuped = DetectX121SMCXSTRPVSiganlSetup(
isSetuped = DetectX121SMCXSiganlSetup(
symbol,
period,
mXSTRPVConditions,
mXConditions,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
@@ -562,25 +591,25 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
);
//
setupDir = mXSTRPVConditions.dir;
setupTime = mXSTRPVConditions.setupTime;
setupDir = mXConditions.dir;
setupTime = mXConditions.setupTime;
//
if (isSetuped)
{
//
int items = AddX121SMCXSTRPVConditionsIfNotExists(
mXSTRPVConditions,
mXSTRPVConditionsCollection //
int items = AddX121SMCXConditionsIfNotExists(
mXConditions,
mXConditionsCollection //
);
//
mXSTRPVConditions.Clean();
mXConditions.Clean();
}
}
//
int conditionsCount = ArraySize(mXSTRPVConditionsCollection);
int conditionsCount = ArraySize(mXConditionsCollection);
result = IsValidSize(conditionsCount);
if (!result)
{
@@ -590,12 +619,12 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
// Looking For Conditions ...
int selectedIndex = 0;
X121SMCStrategyXSTRPVSignalConditions mTmpConditions[];
X121SMCStrategyXSignalConditions mTmpConditions[];
Copy(
mXSTRPVConditionsCollection,
mXConditionsCollection,
mTmpConditions //
);
X121SMCStrategyXSTRPVSignalConditions mConditions;
X121SMCStrategyXSignalConditions mConditions;
for (int i = 0; i < conditionsCount; i++)
{
//
@@ -606,7 +635,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
{
//
// Detect Signal Trigger ...
canTrigger = DetectX121SMCXSTRPVSiganlTrigger(
canTrigger = DetectX121SMCXSiganlTrigger(
mTmpConditions[i],
symbol,
period,
@@ -628,7 +657,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
{
//
ArrayRemove(
mXSTRPVConditionsCollection,
mXConditionsCollection,
i,
1 //
);
@@ -661,7 +690,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
// Remove Selected Index from Main Collection ...
ArrayRemove(
mXSTRPVConditionsCollection,
mXConditionsCollection,
selectedIndex,
1 //
);
@@ -906,6 +935,224 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
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(
@@ -1139,9 +1386,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
void InitialHelpers()
{
//
useXPZSignal = true;
useXRSPVISignal = true;
useXSTRPVSignal = true;
useXSignal = true;
useXPZSignal = false;
useXRSPVISignal = false;
useXSTRPVSignal = false;
//
string symbol = GetSymbol();
@@ -1209,12 +1457,12 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
// XATR ...
x121Inputs.xatrInputs.showATRUpper = showAll || true;
x121Inputs.xatrInputs.showATRLower = showAll || true;
x121Inputs.xatrInputs.showATRUpper = showAll || false;
x121Inputs.xatrInputs.showATRLower = showAll || false;
//
// XSTR ...
x121Inputs.xstrInputs.showStr = showAll || true;
x121Inputs.xstrInputs.showStr = showAll || false;
x121Inputs.xstrInputs.showStrUpper = showAll || false;
x121Inputs.xstrInputs.showStrLower = showAll || false;
@@ -1234,9 +1482,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
// XVWAP ...
x121Inputs.xvwapInputs.showVWapFast = showAll || true;
x121Inputs.xvwapInputs.showVWapMedium = showAll || true;
x121Inputs.xvwapInputs.showVWapSlow = showAll || true;
x121Inputs.xvwapInputs.showVWapFast = showAll || false;
x121Inputs.xvwapInputs.showVWapMedium = showAll || false;
x121Inputs.xvwapInputs.showVWapSlow = showAll || false;
//
// Initialize Cycle Helpers ...