This commit is contained in:
2025-01-23 20:52:45 +03:30
parent aa3630bc82
commit 330c70088c
10 changed files with 3085 additions and 774 deletions
+276 -7
View File
@@ -29,6 +29,7 @@
//
#include "../Signals/x-121.smc.x.signal.lib.mq5"
#include "../Signals/x-121.smc.xpz.signal.lib.mq5"
#include "../Signals/x-121.smc.xpvt.signal.lib.mq5"
#include "../Signals/x-121.smc.xrspvi.signal.lib.mq5"
#include "../Signals/x-121.smc.xstrpv.signal.lib.mq5"
@@ -46,6 +47,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// Props ...
bool useXSignal;
bool useXPZSignal;
bool useXPVTSignal;
bool useXRSPVISignal;
bool useXSTRPVSignal;
@@ -199,6 +201,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
bool hasXSignal = false;
bool hasXPZSignal = false;
bool hasXPVTSignal = false;
bool hasXRSPVISignal = false;
bool hasXSTRPVSignal = false;
@@ -220,6 +223,15 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
hasSignal = hasXPZSignal;
}
//
// XPVT Signal ...
if (useXPVTSignal && !hasSignal)
{
//
hasXPVTSignal = DetectXPVTSignal(conditions);
hasSignal = hasXPVTSignal;
}
//
// XRSPVI Signal ...
if (useXRSPVISignal && !hasSignal)
@@ -427,6 +439,23 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
);
}
//
// XPVT Guard Detection ...
if (useXPVTSignal)
{
//
bool hasGuard = DetectX121SMCXPVTGuards(
guards,
positions,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
}
//
// XSTRPV Guard Detection ...
if (useXSTRPVSignal)
@@ -594,6 +623,23 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
setupDir = mXConditions.dir;
setupTime = mXConditions.setupTime;
// //
// bool hasPivot = mXConditions.pivotZone.IsValid();
// if (hasPivot)
// {
// //
// XCBaseObject *drawnObjects[];
// int drawnCount = DrawX121SMCXConditions(
// mXConditions,
// drawnObjects,
// mPOIDrawer //
// );
// if (IsValidSize(drawnCount))
// {
// AddObjectsIfNotExists(drawnObjects);
// }
// }
//
if (isSetuped)
{
@@ -935,6 +981,224 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
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(
@@ -1388,6 +1652,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
useXSignal = true;
useXPZSignal = false;
useXPVTSignal = false;
useXRSPVISignal = false;
useXSTRPVSignal = false;
@@ -1457,21 +1722,25 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
// XATR ...
x121Inputs.xatrInputs.showATRUpper = showAll || false;
x121Inputs.xatrInputs.showATRLower = showAll || false;
x121Inputs.xatrInputs.showATRUpper = showAll || true;
x121Inputs.xatrInputs.showATRLower = showAll || true;
//
x121Inputs.xatrInputs.atrMultiplier = 1.5;
x121Inputs.xatrInputs.atrSmoothingMode = X_MA_MODE_EMA;
//
// XSTR ...
x121Inputs.xstrInputs.showStr = showAll || false;
x121Inputs.xstrInputs.showStr = true || false;
x121Inputs.xstrInputs.showStrUpper = showAll || false;
x121Inputs.xstrInputs.showStrLower = showAll || false;
//
// XCHE ...
x121Inputs.xcheInputs.showLE1 = showAll || false;
x121Inputs.xcheInputs.showLE2 = showAll || false;
x121Inputs.xcheInputs.showSE1 = showAll || false;
x121Inputs.xcheInputs.showSE2 = showAll || false;
x121Inputs.xcheInputs.showLE1 = showAll || true;
x121Inputs.xcheInputs.showLE2 = showAll || true;
x121Inputs.xcheInputs.showSE1 = showAll || true;
x121Inputs.xcheInputs.showSE2 = showAll || true;
//
// XDON ...