This commit is contained in:
2025-02-04 03:33:59 +03:30
parent 6984b8365f
commit 7e32ebab82
20 changed files with 31271 additions and 12329 deletions
+4 -752
View File
@@ -29,9 +29,6 @@
//
#include "../Signals/x-121.smc.x.signal.lib.mq5"
#include "../Signals/x-121.smc.xobs.signal.lib.mq5"
#include "../Signals/x-121.smc.xhkpv.signal.lib.mq5"
#include "../Signals/x-121.smc.xobpv.signal.lib.mq5"
#include "../Signals/x-121.smc.xiobpv.signal.lib.mq5"
//
// Definitions ...
@@ -47,9 +44,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// Props ...
bool useXSignal;
bool useXOBSSignal;
bool useXHKPVSignal;
bool useXOBPVSignal;
bool useXIOBPVSignal;
//
// Constructor(s) ...
@@ -68,15 +62,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// Deconstructur ...
void ~XCX121SMCStrategy()
{
//
Destroy();
//
Clean(mXConditionsCollection);
Clean(mXOBSConditionsCollection);
Clean(mXHKPVConditionsCollection);
Clean(mXOBPVConditionsCollection);
Clean(mXIOBPVConditionsCollection);
}
//
@@ -117,6 +103,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
*/
void Destroy() override
{
//
Clean(mXConditionsCollection);
Clean(mXOBSConditionsCollection);
//
ZeroMemory(mTriggerCycleHelper);
ZeroMemory(mDecisionCycleHelper);
@@ -212,9 +202,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
bool hasXSignal = false;
bool hasXOBSSignal = false;
bool hasXHKPVSignal = false;
bool hasXOBPVSignal = false;
bool hasXIOBPVSignal = false;
//
// X Signal ...
@@ -234,33 +221,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
hasSignal = hasXOBSSignal;
}
//
// XHKPV Signal ...
if (useXHKPVSignal && !hasSignal)
{
//
hasXHKPVSignal = DetectXHKPVSignal(conditions);
hasSignal = hasXHKPVSignal;
}
//
// XOBPV Signal ...
if (useXOBPVSignal && !hasSignal)
{
//
hasXOBPVSignal = DetectXOBPVSignal(conditions);
hasSignal = hasXOBPVSignal;
}
//
// XIOBPV Signal ...
if (useXIOBPVSignal && !hasSignal)
{
//
hasXIOBPVSignal = DetectXIOBPVSignal(conditions);
hasSignal = hasXIOBPVSignal;
}
//
result = hasSignal;
if (!result)
@@ -450,57 +410,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
);
}
//
// XHKPV Guard Detection ...
if (useXHKPVSignal)
{
//
bool hasGuard = DetectX121SMCXHKPVGuards(
guards,
positions,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
}
//
// XOBPV Guard Detection ...
if (useXOBPVSignal)
{
//
bool hasGuard = DetectX121SMCXOBPVGuards(
guards,
positions,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
}
//
// XIOBPV Guard Detection ...
if (useXIOBPVSignal)
{
//
bool hasGuard = DetectX121SMCXIOBPVGuards(
guards,
positions,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
}
//
count = ArraySize(guards);
result = IsValidSize(count);
@@ -992,660 +901,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
return result;
}
//
// XHKPV Signal ...
bool DetectXHKPVSignal(
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_XHKPV;
string providerStr = ToString(provider);
//
// Detect Setup Conditions ...
datetime setupTime = mXHKPVConditions.setupTime;
bool isSetuped = mXHKPVConditions.IsSetuped();
ENUM_X_DIRECTION setupDir = mXHKPVConditions.dir;
if (!isSetuped)
{
//
// Detect Signal Setup ...
isSetuped = DetectX121SMCXHKPVSignalSetup(
symbol,
period,
mXHKPVConditions,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
//
setupDir = mXHKPVConditions.dir;
setupTime = mXHKPVConditions.setupTime;
//
if (isSetuped)
{
//
int items = AddX121SMCXHKPVConditionsIfNotExists(
mXHKPVConditions,
mXHKPVConditionsCollection //
);
//
mXHKPVConditions.Clean();
}
}
//
int conditionsCount = ArraySize(mXHKPVConditionsCollection);
result = IsValidSize(conditionsCount);
if (!result)
{
return result;
}
//
// Looking For Conditions ...
int selectedIndex = 0;
X121SMCStrategyXHKPVSignalConditions mTmpConditions[];
Copy(
mXHKPVConditionsCollection,
mTmpConditions //
);
X121SMCStrategyXHKPVSignalConditions 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 = DetectX121SMCXHKPVSignalTrigger(
mTmpConditions[i],
symbol,
period,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
//
result = canTrigger;
if (!result)
{
//
bool isISetuped = mTmpConditions[i].IsSetuped();
if (!isISetuped)
{
//
ArrayRemove(
mXHKPVConditionsCollection,
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(
mXHKPVConditionsCollection,
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;
}
//
// XOBPV Signal ...
bool DetectXOBPVSignal(
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_XOBPV;
string providerStr = ToString(provider);
//
// Detect Setup Conditions ...
datetime setupTime = mXOBPVConditions.setupTime;
bool isSetuped = mXOBPVConditions.IsSetuped();
ENUM_X_DIRECTION setupDir = mXOBPVConditions.dir;
if (!isSetuped)
{
//
// Detect Signal Setup ...
isSetuped = DetectX121SMCXOBPVSignalSetup(
symbol,
period,
mXOBPVConditions,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
//
setupDir = mXOBPVConditions.dir;
setupTime = mXOBPVConditions.setupTime;
//
if (isSetuped)
{
//
int items = AddX121SMCXOBPVConditionsIfNotExists(
mXOBPVConditions,
mXOBPVConditionsCollection //
);
//
mXOBPVConditions.Clean();
}
}
//
int conditionsCount = ArraySize(mXOBPVConditionsCollection);
result = IsValidSize(conditionsCount);
if (!result)
{
return result;
}
//
// Looking For Conditions ...
int selectedIndex = 0;
X121SMCStrategyXOBPVSignalConditions mTmpConditions[];
Copy(
mXOBPVConditionsCollection,
mTmpConditions //
);
X121SMCStrategyXOBPVSignalConditions 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 = DetectX121SMCXOBPVSignalTrigger(
mTmpConditions[i],
symbol,
period,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
//
result = canTrigger;
if (!result)
{
//
bool isISetuped = mTmpConditions[i].IsSetuped();
if (!isISetuped)
{
//
ArrayRemove(
mXOBPVConditionsCollection,
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(
mXOBPVConditionsCollection,
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;
}
//
// XIOBPV Signal ...
bool DetectXIOBPVSignal(
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_XIOBPV;
string providerStr = ToString(provider);
//
// Detect Setup Conditions ...
datetime setupTime = mXIOBPVConditions.setupTime;
bool isSetuped = mXIOBPVConditions.IsSetuped();
ENUM_X_DIRECTION setupDir = mXIOBPVConditions.dir;
if (!isSetuped)
{
//
// Detect Signal Setup ...
isSetuped = DetectX121SMCXIOBPVSignalSetup(
symbol,
period,
mXIOBPVConditions,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
//
setupDir = mXIOBPVConditions.dir;
setupTime = mXIOBPVConditions.setupTime;
//
if (isSetuped)
{
//
int items = AddX121SMCXIOBPVConditionsIfNotExists(
mXIOBPVConditions,
mXIOBPVConditionsCollection //
);
//
mXIOBPVConditions.Clean();
}
}
//
int conditionsCount = ArraySize(mXIOBPVConditionsCollection);
result = IsValidSize(conditionsCount);
if (!result)
{
return result;
}
//
// Looking For Conditions ...
int selectedIndex = 0;
X121SMCStrategyXIOBPVSignalConditions mTmpConditions[];
Copy(
mXIOBPVConditionsCollection,
mTmpConditions //
);
X121SMCStrategyXIOBPVSignalConditions 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 = DetectX121SMCXIOBPVSignalTrigger(
mTmpConditions[i],
symbol,
period,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
//
result = canTrigger;
if (!result)
{
//
bool isISetuped = mTmpConditions[i].IsSetuped();
if (!isISetuped)
{
//
ArrayRemove(
mXIOBPVConditionsCollection,
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(
mXIOBPVConditionsCollection,
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;
}
//
// Private ...
private:
@@ -1663,9 +918,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
useXSignal = false;
useXOBSSignal = true;
useXHKPVSignal = false;
useXOBPVSignal = false;
useXIOBPVSignal = false;
//
string symbol = GetSymbol();