add xche to supports list ...

This commit is contained in:
2025-01-13 09:33:02 +03:30
parent 83694f54ff
commit 218dda0a72
14 changed files with 4021 additions and 414 deletions
+269 -17
View File
@@ -30,6 +30,7 @@
#include "../Signals/x-121.smc.test.signal.lib.mq5"
#include "../Signals/x-121.smc.xobgpv.signal.lib.mq5"
#include "../Signals/x-121.smc.xobspv.signal.lib.mq5"
#include "../Signals/x-121.smc.xstrpv.signal.lib.mq5"
//
// Definitions ...
@@ -185,13 +186,15 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
bool useTestSignal = false;
bool useXOBGPVSignal = true;
bool useXOBSPVSignal = true;
bool useXOBGPVSignal = false;
bool useXOBSPVSignal = false;
bool useXSTRPVSignal = true;
//
bool hasTestSignal = false;
bool hasXOBGPVSignal = false;
bool hasXOBSPVSignal = false;
bool hasXSTRPVSignal = false;
//
// Test Signal ...
@@ -220,6 +223,15 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
hasSignal = hasXOBSPVSignal;
}
//
// XSTRPV Signal ...
if (useXSTRPVSignal && !hasSignal)
{
//
hasXSTRPVSignal = DetectXSTRPVSignal(conditions);
hasSignal = hasXSTRPVSignal;
}
//
result = hasSignal;
if (!result)
@@ -325,6 +337,18 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
if (result)
{
//
// Configure Signal Protector ...
if (useXSTRPVSignal)
{
//
signal.trailSL = false;
signal.fullTPLevel = r2r;
signal.partialCloseOnTPLevel = 2;
signal.partialCloseMultiplier = 0.5;
signal.trailSLStartOnReachTPLevel = 2;
}
//
// TODO: Remove this ...
// XCSignalObject *iObj;
@@ -964,6 +988,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;
}
//
// Private ...
private:
@@ -1015,6 +1257,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
x121Inputs.Default();
//
bool showAll = false;
//
x121Inputs.showRSI = false;
@@ -1035,33 +1280,40 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
x121Inputs.xpvInputs.hcPeriod = hcPeriod;
//
x121Inputs.xpvInputs.showSar = true;
x121Inputs.xpvInputs.showPeaks = true;
x121Inputs.xpvInputs.showVales = true;
x121Inputs.xpvInputs.showSar = showAll || true;
x121Inputs.xpvInputs.showPeaks = showAll || true;
x121Inputs.xpvInputs.showVales = showAll || true;
//
// XATR ...
x121Inputs.xatrInputs.showATRUpper = false;
x121Inputs.xatrInputs.showATRLower = false;
x121Inputs.xatrInputs.showATRUpper = showAll || false;
x121Inputs.xatrInputs.showATRLower = showAll || false;
//
// XSTR ...
x121Inputs.xstrInputs.showStr = true;
x121Inputs.xstrInputs.showStrUpper = false;
x121Inputs.xstrInputs.showStrLower = false;
x121Inputs.xstrInputs.showStr = showAll || true;
x121Inputs.xstrInputs.showStrUpper = showAll || false;
x121Inputs.xstrInputs.showStrLower = showAll || false;
//
// XCHE ...
x121Inputs.xcheInputs.showLE1 = showAll || true;
x121Inputs.xcheInputs.showLE2 = showAll || true;
x121Inputs.xcheInputs.showSE1 = showAll || true;
x121Inputs.xcheInputs.showSE2 = showAll || true;
//
// XDON ...
x121Inputs.xdonInputs.showOpen = false;
x121Inputs.xdonInputs.showClose = true;
x121Inputs.xdonInputs.showLow = true;
x121Inputs.xdonInputs.showHigh = true;
x121Inputs.xdonInputs.showOpen = showAll || false;
x121Inputs.xdonInputs.showClose = showAll || false;
x121Inputs.xdonInputs.showLow = showAll || false;
x121Inputs.xdonInputs.showHigh = showAll || false;
//
// XVWAP ...
x121Inputs.xvwapInputs.showVWapFast = false;
x121Inputs.xvwapInputs.showVWapMedium = false;
x121Inputs.xvwapInputs.showVWapSlow = false;
x121Inputs.xvwapInputs.showVWapFast = showAll || false;
x121Inputs.xvwapInputs.showVWapMedium = showAll || false;
x121Inputs.xvwapInputs.showVWapSlow = showAll || false;
//
// Initialize Cycle Helpers ...