last works ...
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
|
||||
//
|
||||
#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
|
||||
//
|
||||
// Props ...
|
||||
bool useXPZSignal;
|
||||
bool useXRSPVISignal;
|
||||
bool useXSTRPVSignal;
|
||||
|
||||
//
|
||||
@@ -64,7 +66,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
{
|
||||
//
|
||||
Destroy();
|
||||
|
||||
//
|
||||
ArrayFree(mXPZConditionsCollection);
|
||||
ArrayFree(mXRSPVIConditionsCollection);
|
||||
ArrayFree(mXSTRPVConditionsCollection);
|
||||
}
|
||||
|
||||
@@ -191,10 +196,11 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
bool hasXPZSignal = false;
|
||||
bool hasXRSPVISignal = false;
|
||||
bool hasXSTRPVSignal = false;
|
||||
|
||||
//
|
||||
// XOBGPV Signal ...
|
||||
// XPZ Signal ...
|
||||
if (useXPZSignal && !hasSignal)
|
||||
{
|
||||
//
|
||||
@@ -202,6 +208,15 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
hasSignal = hasXPZSignal;
|
||||
}
|
||||
|
||||
//
|
||||
// XRSPVI Signal ...
|
||||
if (useXRSPVISignal && !hasSignal)
|
||||
{
|
||||
//
|
||||
hasXRSPVISignal = DetectXRSPVISignal(conditions);
|
||||
hasSignal = hasXRSPVISignal;
|
||||
}
|
||||
|
||||
//
|
||||
// XSTRPV Signal ...
|
||||
if (useXSTRPVSignal && !hasSignal)
|
||||
@@ -400,6 +415,23 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// XRSPVI Guard Detection ...
|
||||
if (useXRSPVISignal)
|
||||
{
|
||||
//
|
||||
bool hasGuard = DetectX121SMCXRSPVIGuards(
|
||||
guards,
|
||||
positions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
count = ArraySize(guards);
|
||||
result = IsValidSize(count);
|
||||
@@ -634,14 +666,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
1 //
|
||||
);
|
||||
|
||||
//
|
||||
XCBaseObject *objects[];
|
||||
DrawX121SMCXSTRPVConditions(
|
||||
mConditions,
|
||||
objects,
|
||||
mPOIDrawer //
|
||||
);
|
||||
|
||||
//
|
||||
// Check Signal Direction ...
|
||||
isBullish = IsBullish(mConditions.dir);
|
||||
@@ -861,11 +885,221 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
);
|
||||
|
||||
//
|
||||
XCBaseObject *objects[];
|
||||
DrawX121SMCXPZConditions(
|
||||
mConditions,
|
||||
objects,
|
||||
mPOIDrawer //
|
||||
// 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,
|
||||
selectedIndex,
|
||||
1 //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -906,6 +1140,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
{
|
||||
//
|
||||
useXPZSignal = true;
|
||||
useXRSPVISignal = true;
|
||||
useXSTRPVSignal = true;
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user