last ...
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
|
||||
//
|
||||
#include "../Signals/x-121.smc.x.signal.lib.mq5"
|
||||
#include "../Signals/x-121.smc.xhkpv.signal.lib.mq5"
|
||||
#include "../Signals/x-121.smc.xobpv.signal.lib.mq5"
|
||||
|
||||
//
|
||||
@@ -43,6 +44,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
// Props ...
|
||||
bool useXSignal;
|
||||
bool useXHKPVSignal;
|
||||
bool useXOBPVSignal;
|
||||
|
||||
//
|
||||
@@ -67,6 +69,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
ArrayFree(mXConditionsCollection);
|
||||
ArrayFree(mXHKPVConditionsCollection);
|
||||
ArrayFree(mXOBPVConditionsCollection);
|
||||
}
|
||||
|
||||
@@ -194,6 +197,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
bool hasXSignal = false;
|
||||
bool hasXHKPVSignal = false;
|
||||
bool hasXOBPVSignal = false;
|
||||
|
||||
//
|
||||
@@ -205,6 +209,15 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
hasSignal = hasXSignal;
|
||||
}
|
||||
|
||||
//
|
||||
// XHKPV Signal ...
|
||||
if (useXHKPVSignal && !hasSignal)
|
||||
{
|
||||
//
|
||||
hasXHKPVSignal = DetectXHKPVSignal(conditions);
|
||||
hasSignal = hasXHKPVSignal;
|
||||
}
|
||||
|
||||
//
|
||||
// XOBPV Signal ...
|
||||
if (useXOBPVSignal && !hasSignal)
|
||||
@@ -386,6 +399,23 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// XHKPV Guard Detection ...
|
||||
if (useXHKPVSignal)
|
||||
{
|
||||
//
|
||||
bool hasGuard = DetectX121SMCXHKPVGuards(
|
||||
guards,
|
||||
positions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// XPZ Guard Detection ...
|
||||
if (useXOBPVSignal)
|
||||
@@ -676,6 +706,224 @@ 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(
|
||||
@@ -910,7 +1158,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
{
|
||||
//
|
||||
useXSignal = false;
|
||||
useXOBPVSignal = true;
|
||||
useXHKPVSignal = true;
|
||||
useXOBPVSignal = false;
|
||||
|
||||
//
|
||||
string symbol = GetSymbol();
|
||||
|
||||
Reference in New Issue
Block a user