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:
2024-12-25 05:17:29 +03:30
parent aa1ffb3ed9
commit 43b3cdc6b9
11 changed files with 2470 additions and 114 deletions
@@ -1330,6 +1330,37 @@ class XC121SMCCycleHelper : public XCBase
return result;
}
/**
* Get Last Peaks Pivot Point ...
*
* @param pivot: XPVPivotPoint instance Reference ...
*
* @return ( bool )
*/
bool GetLastPeakPivotPoint(XPVPivotPoint &pivot)
{
//
bool result = false;
//
pivot.Clean();
//
XPVPivotPoint pivots[];
int count = FillPeakPivotPoints(pivots);
result = IsValidSize(count);
if (!result)
{
return result;
}
//
pivot = pivots[count - 1];
//
return result;
}
/**
* Retrieve All Vale Pivot Point Changes as a Collection ...
*
@@ -1377,6 +1408,37 @@ class XC121SMCCycleHelper : public XCBase
return result;
}
/**
* Get Last Vale Pivot Point ...
*
* @param pivot: XPVPivotPoint instance Reference ...
*
* @return ( bool )
*/
bool GetLastValePivotPoint(XPVPivotPoint &pivot)
{
//
bool result = false;
//
pivot.Clean();
//
XPVPivotPoint pivots[];
int count = FillValePivotPoints(pivots);
result = IsValidSize(count);
if (!result)
{
return result;
}
//
pivot = pivots[count - 1];
//
return result;
}
/**
* Get Current Active Pivot ...
*
+11 -9
View File
@@ -1277,6 +1277,17 @@ class XC121SMCExpert : public XCBaseExpert
mTradeHandler.ResumePausedSymbols();
}
/**
* Re Configure Materials on Properties Changed ...
*/
void ReConfigure() override
{
//
// TODO: Enable this on Production ...
// ReConfigureTradeHandler();
// ReConfigureAllStrategies();
}
/**
* Generate Identifier Tag ...
*
@@ -1562,15 +1573,6 @@ class XC121SMCExpert : public XCBaseExpert
double mHedgingMinVolumeStep; // Minimum Volume Step for Hedging ...
double mHedgeingMinRequiredProfitPerVolumeStep; // Minimum Required Profit Per Volume Step for Hedging ...
//
// Reconfigure Class On Properties Change ...
void ReConfigure()
{
//
ReConfigureTradeHandler();
ReConfigureAllStrategies();
}
//
double CalculateAdditionalVolumeMultiplier(XSignal &signal)
{
+11
View File
@@ -36,6 +36,7 @@ const string X121SMCStrategyToken = "X121SMC";
//
const string X121SMCXTestToken = "X121XTest";
const string X121SMCXPVOBToken = "X121XPVOB";
const string X121SMCXPVSupDemToken = "X121XPVSUPDEM";
//
// X121 SMC Providers ...
@@ -45,6 +46,7 @@ enum ENUM_X_121_SMC_PROVIDERS
X_121_SMC_PROVIDER_NONE,
X_121_SMC_PROVIDER_XTEST,
X_121_SMC_PROVIDER_XPVOB,
X_121_SMC_PROVIDER_XPVSUPDEM,
};
//
@@ -1957,6 +1959,11 @@ string ToString(ENUM_X_121_SMC_PROVIDERS value)
case X_121_SMC_PROVIDER_XPVOB:
result = X121SMCXPVOBToken;
break;
//
case X_121_SMC_PROVIDER_XPVSUPDEM:
result = X121SMCXPVSupDemToken;
break;
}
//
@@ -1990,6 +1997,10 @@ ENUM_X_121_SMC_PROVIDERS ParseProvider(string value)
{
result = X_121_SMC_PROVIDER_XPVOB;
}
else if (Contains(X121SMCXPVSupDemToken, value))
{
result = X_121_SMC_PROVIDER_XPVSUPDEM;
}
//
return result;
@@ -47,9 +47,6 @@ struct X121SMCStrategyTestSignalConditions
datetime setupTime;
datetime triggerTime;
//
// Trigger Props ...
//
// Constructor ...
X121SMCStrategyTestSignalConditions()
@@ -79,6 +76,7 @@ struct X121SMCStrategyTestSignalConditions
triggerTime = NULL;
//
ExtensionClean();
}
/**
@@ -157,6 +155,13 @@ struct X121SMCStrategyTestSignalConditions
//
// Extensions ...
/**
* Clean Additional Properties ...
*/
void ExtensionClean()
{
}
//
};
@@ -359,26 +364,30 @@ bool DetectX121SMCTestSiganlSetup(
XPOIState consolidationState = consolidationConditions.state;
XPOIState visionState = visionConditions.state;
//
// Setup Conditions ...
//
isBullish =
//
false
//
;
//
isBearish =
//
false
//
;
//
result = isBullish ||
isBearish;
if (!result)
{
//
// if (lookupForLong)
// {
// //
// conditions.activeFVG = NULL;
// Clean(conditions.bullishOBs);
// Clean(conditions.bullishFVGs);
// }
// else if (lookupForShort)
// {
// //
// conditions.activeFVG = NULL;
// Clean(conditions.bearishOBs);
// Clean(conditions.bearishFVGs);
// }
// Clean Conditions for Regenerate ...
//
return result;
@@ -605,13 +614,18 @@ bool DetectX121SMCTestSiganlTrigger(
// Trigger Conditions ...
//
// Create Trigger ...
isBullish =
//
false
//
;
//
isBullish = false;
//
isBearish = false;
isBearish =
//
false
//
;
//
result = isBullish ||
@@ -620,13 +634,6 @@ bool DetectX121SMCTestSiganlTrigger(
{
//
// Cleanup Setup Conditions ...
int setupAge = conditions.GetSetupAge();
if (IsValidSize(setupAge) &&
IsValidSize(maxAllowedSetupAge) &&
setupAge >= maxAllowedSetupAge)
{
conditions.Clean();
}
//
return result;
@@ -645,7 +652,4 @@ bool DetectX121SMCTestSiganlTrigger(
return result;
}
//
// Tools Functions ...
//
@@ -56,9 +56,6 @@ struct X121SMCStrategyXPVOBSignalConditions
XCFVG *bullishFVGs[];
XCFVG *bearishFVGs[];
//
// Trigger Props ...
//
// Constructor ...
X121SMCStrategyXPVOBSignalConditions()
@@ -420,11 +417,15 @@ bool DetectX121SMCXPVOBSiganlSetup(
XPOIState visionState = visionConditions.state;
//
// Detect Imbalances ...
// Setup Conditions ...
//
// Select Source State ...
XPOIState state = decisionState;
//
// Detect Imbalance ...
//
bool hasBullishOB = conditions.HasBullishOB();
if (!hasBullishOB)
File diff suppressed because it is too large Load Diff
+269 -52
View File
@@ -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: