complete XPVSUPDEM Provider and attached it to SMC Strategy ...
also Cleanup Test Provider and Make a Backup of it for Next Usages ...
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
//
|
||||
#include "../Signals/x-121.smc.test.signal.class.mq5"
|
||||
#include "../Signals/x-121.smc.xpvob.signal.class.mq5"
|
||||
#include "../Signals/x-121.smc.xpvsupdem.signal.class.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
@@ -157,6 +158,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
bool hasTestSignal = false;
|
||||
bool hasXPVOBSignal = false;
|
||||
bool hasXPVSUPDEMSignal = false;
|
||||
|
||||
//
|
||||
// Test Signal ...
|
||||
@@ -176,6 +178,15 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
// hasSignal = hasXPVOBSignal;
|
||||
}
|
||||
|
||||
//
|
||||
// XPVSUPDEM Signal ...
|
||||
if (!hasSignal)
|
||||
{
|
||||
//
|
||||
hasXPVSUPDEMSignal = DetectXPVSUPDEMSignal(conditions);
|
||||
hasSignal = hasXPVSUPDEMSignal;
|
||||
}
|
||||
|
||||
//
|
||||
result = hasSignal;
|
||||
if (!result)
|
||||
@@ -262,12 +273,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
signal.time = TimeCurrent();
|
||||
|
||||
//
|
||||
// XPVOB Signal ...
|
||||
if (hasXPVOBSignal)
|
||||
// Configure Signal Protecting ...
|
||||
if (hasXPVOBSignal ||
|
||||
hasXPVSUPDEMSignal)
|
||||
{
|
||||
//
|
||||
// Add Aditionsal Info ...
|
||||
|
||||
//
|
||||
signal.fullTPLevel = r2r;
|
||||
signal.partialCloseOnTPLevel = 2;
|
||||
@@ -545,23 +554,66 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
result = isSetuped;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
setupDir = mTestConditions.dir;
|
||||
setupTime = mTestConditions.setupTime;
|
||||
}
|
||||
|
||||
// ClearDraws();
|
||||
// ENUM_X_DIRECTION activeZoneDir;
|
||||
// bool hasTicksZone = mTestConditions.HasTicksZone();
|
||||
// bool hasActiveZone = mTestConditions.HasActiveZone(activeZoneDir);
|
||||
// if (hasActiveZone)
|
||||
// {
|
||||
// //
|
||||
// if (IsBullish(activeZoneDir))
|
||||
// {
|
||||
// //
|
||||
// mTestConditions.activeDemandZone.To(cTime);
|
||||
// XCDemandZoneObject *iObj;
|
||||
// bool isCreated = mPOIDrawer.CreateDemandZone(
|
||||
// mTestConditions.activeDemandZone,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// AddObjectIfNotExists(iObj);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //
|
||||
// mTestConditions.activeSupplyZone.To(cTime);
|
||||
// XCSupplyZoneObject *iObj;
|
||||
// bool isCreated = mPOIDrawer.CreateSupplyZone(
|
||||
// mTestConditions.activeSupplyZone,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// AddObjectIfNotExists(iObj);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (hasTicksZone)
|
||||
// {
|
||||
// //
|
||||
// XCTicksZoneObject *iObj;
|
||||
// bool isCreated = mPOIDrawer.CreateTicksZone(
|
||||
// mTestConditions.ticksZone,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// AddObjectIfNotExists(iObj);
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
// Draw Conditions Active FVG ...
|
||||
if (isSetuped)
|
||||
result = isSetuped;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -681,43 +733,43 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
// Draw Conditions Active FVG ...
|
||||
if (isSetuped)
|
||||
{
|
||||
//
|
||||
XCFVG *iFVG = mXPVOBConditions.activeFVG;
|
||||
if (iFVG != NULL && iFVG.IsValid())
|
||||
{
|
||||
//
|
||||
ClearDraws();
|
||||
iFVG.To(cTime);
|
||||
if (IsBullish(setupDir) && iFVG.IsBullish())
|
||||
{
|
||||
//
|
||||
XCBullishFairValueGapObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateBullishFairValueGap(
|
||||
iFVG,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
else if (IsBearish(setupDir) && iFVG.IsBearish())
|
||||
{
|
||||
//
|
||||
XCBearishFairValueGapObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateBearishFairValueGap(
|
||||
iFVG,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (isSetuped)
|
||||
// {
|
||||
// //
|
||||
// XCFVG *iFVG = mXPVOBConditions.activeFVG;
|
||||
// if (iFVG != NULL && iFVG.IsValid())
|
||||
// {
|
||||
// //
|
||||
// ClearDraws();
|
||||
// iFVG.To(cTime);
|
||||
// if (IsBullish(setupDir) && iFVG.IsBullish())
|
||||
// {
|
||||
// //
|
||||
// XCBullishFairValueGapObject *iObj;
|
||||
// bool isCreated = mPOIDrawer.CreateBullishFairValueGap(
|
||||
// iFVG,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// AddObjectIfNotExists(iObj);
|
||||
// }
|
||||
// }
|
||||
// else if (IsBearish(setupDir) && iFVG.IsBearish())
|
||||
// {
|
||||
// //
|
||||
// XCBearishFairValueGapObject *iObj;
|
||||
// bool isCreated = mPOIDrawer.CreateBearishFairValueGap(
|
||||
// iFVG,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// AddObjectIfNotExists(iObj);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
// Detect Trigger Conditions ...
|
||||
@@ -776,6 +828,171 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XPVSUPDEM Signal ...
|
||||
X121SMCStrategyXPVSUPDEMSignalConditions mXPVSUPDEMConditions;
|
||||
bool DetectXPVSUPDEMSignal(
|
||||
X121SMCStrategyConditions &conditions //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
bool isBullish = false;
|
||||
bool isBearish = false;
|
||||
|
||||
//
|
||||
string symbol = GetSymbol();
|
||||
ENUM_TIMEFRAMES period = GetPeriod();
|
||||
|
||||
//
|
||||
datetime cTime = TimeCurrent();
|
||||
|
||||
//
|
||||
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XPVSUPDEM;
|
||||
string providerStr = ToString(provider);
|
||||
|
||||
//
|
||||
// Detect Setup Conditions ...
|
||||
datetime setupTime = mXPVSUPDEMConditions.setupTime;
|
||||
bool isSetuped = mXPVSUPDEMConditions.IsSetuped();
|
||||
ENUM_X_DIRECTION setupDir = mXPVSUPDEMConditions.dir;
|
||||
if (!isSetuped)
|
||||
{
|
||||
//
|
||||
// Detect Signal Setup ...
|
||||
isSetuped = DetectX121SMCXPVSUPDEMSiganlSetup(
|
||||
symbol,
|
||||
period,
|
||||
mXPVSUPDEMConditions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
setupDir = mXPVSUPDEMConditions.dir;
|
||||
setupTime = mXPVSUPDEMConditions.setupTime;
|
||||
}
|
||||
|
||||
// ClearDraws();
|
||||
// ENUM_X_DIRECTION activeZoneDir;
|
||||
// bool hasTicksZone = mXPVSUPDEMConditions.HasTicksZone();
|
||||
// bool hasActiveZone = mXPVSUPDEMConditions.HasActiveZone(activeZoneDir);
|
||||
// if (hasActiveZone)
|
||||
// {
|
||||
// //
|
||||
// if (IsBullish(activeZoneDir))
|
||||
// {
|
||||
// //
|
||||
// mXPVSUPDEMConditions.activeDemandZone.To(cTime);
|
||||
// XCDemandZoneObject *iObj;
|
||||
// bool isCreated = mPOIDrawer.CreateDemandZone(
|
||||
// mXPVSUPDEMConditions.activeDemandZone,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// AddObjectIfNotExists(iObj);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //
|
||||
// mXPVSUPDEMConditions.activeSupplyZone.To(cTime);
|
||||
// XCSupplyZoneObject *iObj;
|
||||
// bool isCreated = mPOIDrawer.CreateSupplyZone(
|
||||
// mXPVSUPDEMConditions.activeSupplyZone,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// AddObjectIfNotExists(iObj);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (hasTicksZone)
|
||||
// {
|
||||
// //
|
||||
// XCTicksZoneObject *iObj;
|
||||
// bool isCreated = mPOIDrawer.CreateTicksZone(
|
||||
// mXPVSUPDEMConditions.ticksZone,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// AddObjectIfNotExists(iObj);
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
result = isSetuped;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Trigger Conditions ...
|
||||
bool canTrigger = mXPVSUPDEMConditions.CanTrigger();
|
||||
datetime triggerTime = mXPVSUPDEMConditions.triggerTime;
|
||||
if (!canTrigger)
|
||||
{
|
||||
//
|
||||
// Detect Signal Trigger ...
|
||||
canTrigger = DetectX121SMCXPVSUPDEMSiganlTrigger(
|
||||
mXPVSUPDEMConditions,
|
||||
symbol,
|
||||
period,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
result = canTrigger;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
triggerTime = mXPVSUPDEMConditions.triggerTime;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Signal Direction ...
|
||||
|
||||
//
|
||||
isBullish = IsBullish(setupDir);
|
||||
isBearish = IsBearish(setupDir);
|
||||
result = isBullish ||
|
||||
isBearish;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Issues Signal on Conditions ...
|
||||
conditions.signalDir = setupDir;
|
||||
conditions.provider = providerStr;
|
||||
conditions.sl = mXPVSUPDEMConditions.sl;
|
||||
|
||||
//
|
||||
mXPVSUPDEMConditions.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user