last ...
This commit is contained in:
@@ -28,8 +28,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.xpz.signal.lib.mq5"
|
||||
#include "../Signals/x-121.smc.xstrpv.signal.lib.mq5"
|
||||
|
||||
//
|
||||
@@ -43,6 +42,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Props ...
|
||||
bool useTestSignal;
|
||||
bool useXPZSignal;
|
||||
bool useXSTRPVSignal;
|
||||
|
||||
//
|
||||
// Constructor(s) ...
|
||||
@@ -184,16 +187,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
// Detect Signal Conditions ...
|
||||
bool hasSignal = false;
|
||||
|
||||
//
|
||||
bool useTestSignal = false;
|
||||
bool useXOBGPVSignal = false;
|
||||
bool useXOBSPVSignal = false;
|
||||
bool useXSTRPVSignal = true;
|
||||
|
||||
//
|
||||
bool hasTestSignal = false;
|
||||
bool hasXOBGPVSignal = false;
|
||||
bool hasXOBSPVSignal = false;
|
||||
bool hasXPZSignal = false;
|
||||
bool hasXSTRPVSignal = false;
|
||||
|
||||
//
|
||||
@@ -207,20 +203,11 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
// XOBGPV Signal ...
|
||||
if (useXOBGPVSignal && !hasSignal)
|
||||
if (useXPZSignal && !hasSignal)
|
||||
{
|
||||
//
|
||||
hasXOBGPVSignal = DetectXOBGPVSignal(conditions);
|
||||
hasSignal = hasXOBGPVSignal;
|
||||
}
|
||||
|
||||
//
|
||||
// XOBSPV Signal ...
|
||||
if (useXOBSPVSignal && !hasSignal)
|
||||
{
|
||||
//
|
||||
hasXOBSPVSignal = DetectXOBSPVSignal(conditions);
|
||||
hasSignal = hasXOBSPVSignal;
|
||||
hasXPZSignal = DetectXPZSignal(conditions);
|
||||
hasSignal = hasXPZSignal;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -339,15 +326,15 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
{
|
||||
//
|
||||
// Configure Signal Protector ...
|
||||
if (useXSTRPVSignal)
|
||||
{
|
||||
//
|
||||
signal.trailSL = false;
|
||||
signal.fullTPLevel = r2r;
|
||||
signal.partialCloseOnTPLevel = 2;
|
||||
signal.partialCloseMultiplier = 0.5;
|
||||
signal.trailSLStartOnReachTPLevel = 2;
|
||||
}
|
||||
// if (useXSTRPVSignal)
|
||||
// {
|
||||
// //
|
||||
// signal.trailSL = false;
|
||||
// signal.fullTPLevel = r2r;
|
||||
// signal.partialCloseOnTPLevel = 2;
|
||||
// signal.partialCloseMultiplier = 0.5;
|
||||
// signal.trailSLStartOnReachTPLevel = 2;
|
||||
// }
|
||||
|
||||
//
|
||||
// TODO: Remove this ...
|
||||
@@ -365,6 +352,76 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for any Guard Actions ...
|
||||
*/
|
||||
bool CheckGuard(
|
||||
X121SMCGuard &guards[],
|
||||
const XPosition &positions[] //
|
||||
) override
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
Clean(guards);
|
||||
|
||||
//
|
||||
int count = ArraySize(positions);
|
||||
result = IsValidSize(count);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XTEST Guard Detection ...
|
||||
if (useTestSignal)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// XSTRPV Guard Detection ...
|
||||
if (useXSTRPVSignal)
|
||||
{
|
||||
//
|
||||
bool hasGuard = DetectX121SMCXSTRPVGuards(
|
||||
guards,
|
||||
positions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// XPZ Guard Detection ...
|
||||
if (useXPZSignal)
|
||||
{
|
||||
//
|
||||
bool hasGuard = DetectX121SMCXPZGuards(
|
||||
guards,
|
||||
positions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
count = ArraySize(guards);
|
||||
result = IsValidSize(count);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Customize Strategy Identifier ...
|
||||
*/
|
||||
@@ -511,483 +568,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XOBGPV Signal ...
|
||||
bool DetectXOBGPVSignal(
|
||||
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_XOBGPV;
|
||||
string providerStr = ToString(provider);
|
||||
|
||||
//
|
||||
// Detect Setup Conditions ...
|
||||
datetime setupTime = mXOBGPVConditions.setupTime;
|
||||
bool isSetuped = mXOBGPVConditions.IsSetuped();
|
||||
ENUM_X_DIRECTION setupDir = mXOBGPVConditions.dir;
|
||||
if (!isSetuped)
|
||||
{
|
||||
//
|
||||
// Detect Signal Setup ...
|
||||
isSetuped = DetectX121SMCXOBGPVSiganlSetup(
|
||||
symbol,
|
||||
period,
|
||||
mXOBGPVConditions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
setupDir = mXOBGPVConditions.dir;
|
||||
setupTime = mXOBGPVConditions.setupTime;
|
||||
|
||||
//
|
||||
if (isSetuped)
|
||||
{
|
||||
//
|
||||
int items = AddX121SMCXOBGPVConditionsIfNotExists(
|
||||
mXOBGPVConditions,
|
||||
mXOBGPVConditionsCollection //
|
||||
);
|
||||
|
||||
//
|
||||
mXOBGPVConditions.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
int conditionsCount = ArraySize(mXOBGPVConditionsCollection);
|
||||
result = IsValidSize(conditionsCount);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Looking For Conditions ...
|
||||
int selectedIndex = 0;
|
||||
X121SMCStrategyXOBGPVSignalConditions mTmpConditions[];
|
||||
Copy(
|
||||
mXOBGPVConditionsCollection,
|
||||
mTmpConditions //
|
||||
);
|
||||
X121SMCStrategyXOBGPVSignalConditions mConditions;
|
||||
for (int i = 0; i < conditionsCount; i++)
|
||||
{
|
||||
//
|
||||
// Update Conditions ...
|
||||
mTmpConditions[i].UpdateOrderBlocks();
|
||||
|
||||
//
|
||||
// Retrieve Required Data ...
|
||||
ENUM_X_DIRECTION iDir = mTmpConditions[i].dir;
|
||||
bool isIBullish = IsBullish(iDir);
|
||||
double iUpper = 0;
|
||||
double iLower = 0;
|
||||
bool iHasBoundary = mTmpConditions[i].fvgOB.GetBoundary(
|
||||
iUpper,
|
||||
iLower //
|
||||
);
|
||||
if (!iHasBoundary)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Conditions ...
|
||||
|
||||
//
|
||||
XFVGOrderBlock iFVGOB = mTmpConditions[i].fvgOB;
|
||||
XCBaseObject *drawnObjects[];
|
||||
mPOIDrawer.DrawFVGOrderBlock(
|
||||
iFVGOB,
|
||||
drawnObjects //
|
||||
);
|
||||
AddObjectsIfNotExists(drawnObjects);
|
||||
|
||||
//
|
||||
// Check Broken Order Blocks and Remove them ...
|
||||
bool isBreaked =
|
||||
isBullish
|
||||
? (cBar.high < iLower ||
|
||||
pBar.high < iLower)
|
||||
: (cBar.low > iUpper ||
|
||||
cBar.low > iUpper);
|
||||
if (isBreaked)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
mXOBGPVConditionsCollection,
|
||||
i,
|
||||
1 //
|
||||
);
|
||||
|
||||
//
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Triggers ...
|
||||
bool canTrigger = mTmpConditions[i].CanTrigger();
|
||||
datetime triggerTime = mTmpConditions[i].triggerTime;
|
||||
if (!canTrigger)
|
||||
{
|
||||
//
|
||||
// Detect Signal Trigger ...
|
||||
canTrigger = DetectX121SMCXOBGPVSiganlTrigger(
|
||||
mTmpConditions[i],
|
||||
symbol,
|
||||
period,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
result = canTrigger;
|
||||
if (!result)
|
||||
{
|
||||
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(
|
||||
mXOBGPVConditionsCollection,
|
||||
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;
|
||||
}
|
||||
|
||||
//
|
||||
// XOBSPV Signal ...
|
||||
bool DetectXOBSPVSignal(
|
||||
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_XOBSPV;
|
||||
string providerStr = ToString(provider);
|
||||
|
||||
//
|
||||
// Detect Setup Conditions ...
|
||||
datetime setupTime = mXOBSPVConditions.setupTime;
|
||||
bool isSetuped = mXOBSPVConditions.IsSetuped();
|
||||
ENUM_X_DIRECTION setupDir = mXOBSPVConditions.dir;
|
||||
if (!isSetuped)
|
||||
{
|
||||
//
|
||||
// Detect Signal Setup ...
|
||||
isSetuped = DetectX121SMCXOBSPVSiganlSetup(
|
||||
symbol,
|
||||
period,
|
||||
mXOBSPVConditions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
setupDir = mXOBSPVConditions.dir;
|
||||
setupTime = mXOBSPVConditions.setupTime;
|
||||
|
||||
//
|
||||
if (isSetuped)
|
||||
{
|
||||
//
|
||||
int items = AddX121SMCXOBSPVConditionsIfNotExists(
|
||||
mXOBSPVConditions,
|
||||
mXOBSPVConditionsCollection //
|
||||
);
|
||||
|
||||
//
|
||||
mXOBSPVConditions.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
int conditionsCount = ArraySize(mXOBSPVConditionsCollection);
|
||||
result = IsValidSize(conditionsCount);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Looking For Conditions ...
|
||||
int selectedIndex = 0;
|
||||
X121SMCStrategyXOBSPVSignalConditions mTmpConditions[];
|
||||
Copy(
|
||||
mXOBSPVConditionsCollection,
|
||||
mTmpConditions //
|
||||
);
|
||||
X121SMCStrategyXOBSPVSignalConditions 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 = DetectX121SMCXOBSPVSiganlTrigger(
|
||||
mTmpConditions[i],
|
||||
symbol,
|
||||
period,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
result = canTrigger;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
bool isISetuped = mTmpConditions[i].IsSetuped();
|
||||
if (!isISetuped)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
mXOBSPVConditionsCollection,
|
||||
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(
|
||||
mXOBSPVConditionsCollection,
|
||||
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(
|
||||
@@ -1214,6 +794,232 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XPZ Signal ...
|
||||
bool DetectXPZSignal(
|
||||
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_XPZ;
|
||||
string providerStr = ToString(provider);
|
||||
|
||||
//
|
||||
// Detect Setup Conditions ...
|
||||
datetime setupTime = mXPZConditions.setupTime;
|
||||
bool isSetuped = mXPZConditions.IsSetuped();
|
||||
ENUM_X_DIRECTION setupDir = mXPZConditions.dir;
|
||||
if (!isSetuped)
|
||||
{
|
||||
//
|
||||
// Detect Signal Setup ...
|
||||
isSetuped = DetectX121SMCXPZSiganlSetup(
|
||||
symbol,
|
||||
period,
|
||||
mXPZConditions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
setupDir = mXPZConditions.dir;
|
||||
setupTime = mXPZConditions.setupTime;
|
||||
|
||||
//
|
||||
if (isSetuped)
|
||||
{
|
||||
//
|
||||
int items = AddX121SMCXPZConditionsIfNotExists(
|
||||
mXPZConditions,
|
||||
mXPZConditionsCollection //
|
||||
);
|
||||
|
||||
//
|
||||
mXPZConditions.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
int conditionsCount = ArraySize(mXPZConditionsCollection);
|
||||
result = IsValidSize(conditionsCount);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Looking For Conditions ...
|
||||
int selectedIndex = 0;
|
||||
X121SMCStrategyXPZSignalConditions mTmpConditions[];
|
||||
Copy(
|
||||
mXPZConditionsCollection,
|
||||
mTmpConditions //
|
||||
);
|
||||
X121SMCStrategyXPZSignalConditions 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 = DetectX121SMCXPZSiganlTrigger(
|
||||
mTmpConditions[i],
|
||||
symbol,
|
||||
period,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
result = canTrigger;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
bool isISetuped = mTmpConditions[i].IsSetuped();
|
||||
if (!isISetuped)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
mXPZConditionsCollection,
|
||||
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(
|
||||
mXPZConditionsCollection,
|
||||
selectedIndex,
|
||||
1 //
|
||||
);
|
||||
|
||||
//
|
||||
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;
|
||||
}
|
||||
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
@@ -1228,6 +1034,11 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
*/
|
||||
void InitialHelpers()
|
||||
{
|
||||
//
|
||||
useTestSignal = false;
|
||||
useXPZSignal = true;
|
||||
useXSTRPVSignal = true;
|
||||
|
||||
//
|
||||
string symbol = GetSymbol();
|
||||
ENUM_TIMEFRAMES period = GetPeriod();
|
||||
|
||||
Reference in New Issue
Block a user