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
+27 -2
View File
@@ -1527,7 +1527,6 @@ class XCConsolidationZoneObject : public XCBaseObject
ObjName(name);
}
//
return result;
}
@@ -2168,7 +2167,7 @@ class XCTickZoneObject : public XCBaseObject
chart_id,
lblName,
window,
from,
to,
zone.high //
);
if (!result)
@@ -2179,6 +2178,23 @@ class XCTickZoneObject : public XCBaseObject
//
mLabel.Description(ToString(zone.percent) + "%");
//
string lblVName = "LBLV_" + name;
result = mVLabel.Create(
chart_id,
lblVName,
window,
to,
zone.low //
);
if (!result)
{
return result;
}
//
mVLabel.Description(ToString(zone.volumePercent) + "%");
//
ObjName(name);
@@ -2256,7 +2272,9 @@ class XCTickZoneObject : public XCBaseObject
*/
void LabelColor(color value)
{
//
mLabel.Color(value);
mVLabel.Color(value);
}
/**
@@ -2266,7 +2284,9 @@ class XCTickZoneObject : public XCBaseObject
*/
void LabelSize(int value)
{
//
mLabel.FontSize(value);
mVLabel.FontSize(value);
}
/**
@@ -2276,7 +2296,9 @@ class XCTickZoneObject : public XCBaseObject
*/
void LabelFont(string value)
{
//
mLabel.Font(value);
mVLabel.Font(value);
}
/**
@@ -2286,7 +2308,9 @@ class XCTickZoneObject : public XCBaseObject
*/
void LabelAngle(double value)
{
//
mLabel.Angle(value);
mVLabel.Angle(value);
}
//
@@ -2295,6 +2319,7 @@ class XCTickZoneObject : public XCBaseObject
// Props ...
CChartObjectRectangle mRect;
CChartObjectLabel mLabel;
CChartObjectLabel mVLabel;
//
};
+18 -14
View File
@@ -81,7 +81,7 @@ class XCBaseExpert : public XCBaseAlert
{
//
mMagicNumber = value;
InitEA();
ReConfigure();
}
/**
@@ -103,7 +103,7 @@ class XCBaseExpert : public XCBaseAlert
{
//
mSlippage = value;
InitEA();
ReConfigure();
}
/**
@@ -125,7 +125,7 @@ class XCBaseExpert : public XCBaseAlert
{
//
mTagPrefix = value;
InitEA();
ReConfigure();
}
//
@@ -150,7 +150,7 @@ class XCBaseExpert : public XCBaseAlert
{
//
mPeriod = value;
InitEA();
ReConfigure();
}
/**
@@ -172,7 +172,7 @@ class XCBaseExpert : public XCBaseAlert
{
//
mSymbol = value;
InitEA();
ReConfigure();
}
/**
@@ -194,7 +194,7 @@ class XCBaseExpert : public XCBaseAlert
{
//
mMultiSymbol = value;
InitEA();
ReConfigure();
}
/**
@@ -216,7 +216,7 @@ class XCBaseExpert : public XCBaseAlert
{
//
mSymbols = value;
InitEA();
ReConfigure();
}
//
@@ -241,7 +241,7 @@ class XCBaseExpert : public XCBaseAlert
{
//
mDisabled = value;
InitEA();
ReConfigure();
}
/**
@@ -263,7 +263,7 @@ class XCBaseExpert : public XCBaseAlert
{
//
mAllowLong = value;
InitEA();
ReConfigure();
}
/**
@@ -285,7 +285,7 @@ class XCBaseExpert : public XCBaseAlert
{
//
mAllowShort = value;
InitEA();
ReConfigure();
}
//
@@ -310,7 +310,7 @@ class XCBaseExpert : public XCBaseAlert
{
//
mReportNewMonths = value;
InitEA();
ReConfigure();
}
/**
@@ -332,7 +332,7 @@ class XCBaseExpert : public XCBaseAlert
{
//
mReportNewWeeks = value;
InitEA();
ReConfigure();
}
/**
@@ -354,7 +354,7 @@ class XCBaseExpert : public XCBaseAlert
{
//
mReportNewDays = value;
InitEA();
ReConfigure();
}
/**
@@ -376,7 +376,7 @@ class XCBaseExpert : public XCBaseAlert
{
//
mReportNewHours = value;
InitEA();
ReConfigure();
}
//
@@ -805,6 +805,10 @@ class XCBaseExpert : public XCBaseAlert
{
}
virtual void ReConfigure()
{
}
/**
* Generate Identifier Tag ...
*
+830
View File
@@ -0,0 +1,830 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 X121 SMC Signal Class
// -------------------------------------------------
// Name:
// Description: provide all Signalling functions ...
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
// Global Properties ...
#property library
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://www.saherelm.ir"
#property version "1.00"
#property strict
//
// Imports ...
#include "../Classes/x-121.smc.market.cycle.helper.class.mq5"
#include "../Libraries/x-121.smc.lib.mq5"
//
// Definitions ...
struct X121SMCStrategyTestSignalConditions
{
//
// Props ...
//
string symbol;
ENUM_TIMEFRAMES period;
//
double sl;
ENUM_X_DIRECTION dir;
ENUM_X_POSITION_TYPES type;
//
// Setup Props ...
//
datetime setupTime;
datetime triggerTime;
//
// Constructor ...
X121SMCStrategyTestSignalConditions()
{
Clean();
}
//
// Tools ...
/**
* Cleaning Up ...
*/
void Clean()
{
//
sl = 0;
//
dir = X_DIRECTION_NONE;
type = X_POSITION_TYPE_NONE;
//
symbol = NULL;
period = NULL;
setupTime = NULL;
triggerTime = NULL;
//
ExtensionClean();
}
/**
* Check Condition is Setting Up ...
*
* @param dir: ENUM_X_DIRECTION member, Setting Up Direction ...
*
* @return ( bool )
*/
bool IsSetuped()
{
//
bool result = false;
//
result = IsValid(setupTime) &&
HasDirection(dir);
if (!result)
{
return result;
}
//
return result;
}
/**
* Calculate Setup Age ...
*
* @return ( int )
*/
int GetSetupAge()
{
//
int result = 0;
//
if (!IsSetuped())
{
return result;
}
//
result = (int)(TimeCurrent() - setupTime) / PeriodSeconds(period);
//
return result;
}
/**
* Detect How we Can Trigger Signal ...
*
* @return ( bool )
*/
bool CanTrigger()
{
//
bool result = false;
//
result =
//
sl > 0 &&
IsValid(symbol) &&
IsValid(period) &&
IsValid(triggerTime) &&
type != X_POSITION_TYPE_ALL &&
type != X_POSITION_TYPE_NONE
//
;
//
return result;
}
//
// Extensions ...
/**
* Clean Additional Properties ...
*/
void ExtensionClean()
{
}
//
};
//
// Extension Functions ...
//
// Detect Setup Conditions ...
bool DetectX121SMCTestSiganlSetup(
string _symbol,
ENUM_TIMEFRAMES _period,
//
X121SMCStrategyTestSignalConditions &conditions,
//
XC121SMCCycleHelper *triggerCycleHelper,
XC121SMCCycleHelper *decisionCycleHelper,
XC121SMCCycleHelper *analyseCycleHelper,
XC121SMCCycleHelper *verificationCycleHelper,
XC121SMCCycleHelper *consolidationCycleHelper,
XC121SMCCycleHelper *visionCycleHelper
//
)
{
//
bool result = false;
//
bool isBullish = false;
bool isBearish = false;
//
int zIndex = 0;
int cIndex = zIndex + 1;
int pIndex = cIndex + 1;
int ppIndex = pIndex + 1;
//
int loopback = 10;
//
string symbol = _symbol;
ENUM_TIMEFRAMES period = _period;
//
conditions.symbol = symbol;
conditions.period = period;
//
XOHCL zBar;
result = zBar.Init(
symbol,
period,
zIndex //
);
if (!result)
{
return result;
}
//
XOHCL cBar;
result = cBar.Init(
symbol,
period,
cIndex //
);
if (!result)
{
return result;
}
//
double ask = GetAsk(symbol);
double bid = GetBid(symbol);
datetime cTime = TimeCurrent();
//
double ll = cBar.FindLowest(9, MODE_LOW);
double hh = cBar.FindHighest(9, MODE_HIGH);
//
int zoneValidationDivider = 10;
int validPivotRepetition = triggerCycleHelper.mX121Helper
.GetDonChainLength();
//
double selectedSL = 0;
//
// Cycles Conditions ...
//
// Trigger ...
ENUM_XPOI_EVENTS triggerPoiEvents[];
ENUM_X_CYCLE_EVENTS triggerCycleEvents[];
X121SMCCycleConditions triggerConditions;
result = triggerCycleHelper.GetConditions(
triggerCycleEvents,
triggerPoiEvents,
triggerConditions,
zIndex,
loopback //
);
if (!result)
{
return result;
}
//
// Decision ...
ENUM_XPOI_EVENTS decisionPoiEvents[];
ENUM_X_CYCLE_EVENTS decisionCycleEvents[];
X121SMCCycleConditions decisionConditions;
result = decisionCycleHelper.GetConditions(
decisionCycleEvents,
decisionPoiEvents,
decisionConditions,
zIndex,
loopback //
);
if (!result)
{
return result;
}
//
// Analyse ...
ENUM_XPOI_EVENTS analysePoiEvents[];
ENUM_X_CYCLE_EVENTS analyseCycleEvents[];
X121SMCCycleConditions analyseConditions;
result = analyseCycleHelper.GetConditions(
analyseCycleEvents,
analysePoiEvents,
analyseConditions,
zIndex,
loopback //
);
if (!result)
{
return result;
}
//
// Verification ...
ENUM_XPOI_EVENTS verificationPoiEvents[];
ENUM_X_CYCLE_EVENTS verificationCycleEvents[];
X121SMCCycleConditions verificationConditions;
result = verificationCycleHelper.GetConditions(
verificationCycleEvents,
verificationPoiEvents,
verificationConditions,
zIndex,
loopback //
);
if (!result)
{
return result;
}
//
// Consolidation ...
ENUM_XPOI_EVENTS consolidationPoiEvents[];
ENUM_X_CYCLE_EVENTS consolidationCycleEvents[];
X121SMCCycleConditions consolidationConditions;
result = consolidationCycleHelper.GetConditions(
consolidationCycleEvents,
consolidationPoiEvents,
consolidationConditions,
zIndex,
loopback //
);
if (!result)
{
return result;
}
//
// Vision ...
ENUM_XPOI_EVENTS visionPoiEvents[];
ENUM_X_CYCLE_EVENTS visionCycleEvents[];
X121SMCCycleConditions visionConditions;
result = visionCycleHelper.GetConditions(
visionCycleEvents,
visionPoiEvents,
visionConditions,
zIndex,
loopback //
);
if (!result)
{
return result;
}
//
// Cycles POI States ...
XPOIState triggerState = triggerConditions.state;
XPOIState decisionState = decisionConditions.state;
XPOIState analyseState = analyseConditions.state;
XPOIState verificationState = verificationConditions.state;
XPOIState consolidationState = consolidationConditions.state;
XPOIState visionState = visionConditions.state;
//
// Setup Conditions ...
//
isBullish =
//
false
//
;
//
isBearish =
//
false
//
;
//
result = isBullish ||
isBearish;
if (!result)
{
//
// Clean Conditions for Regenerate ...
//
return result;
}
//
conditions.setupTime = cTime;
conditions.dir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
return result;
}
//
// Detect Trigger Conditions ...
bool DetectX121SMCTestSiganlTrigger(
//
X121SMCStrategyTestSignalConditions &conditions,
//
string _symbol,
ENUM_TIMEFRAMES _period,
//
XC121SMCCycleHelper *triggerCycleHelper,
XC121SMCCycleHelper *decisionCycleHelper,
XC121SMCCycleHelper *analyseCycleHelper,
XC121SMCCycleHelper *verificationCycleHelper,
XC121SMCCycleHelper *consolidationCycleHelper,
XC121SMCCycleHelper *visionCycleHelper,
//
int maxAllowedSetupAge = 60 //
//
)
{
//
bool result = false;
//
result = conditions.IsSetuped();
if (!result)
{
return result;
}
//
datetime setupTime = conditions.setupTime;
ENUM_X_DIRECTION setupDir = conditions.dir;
//
bool isBullish = false;
bool isBearish = false;
//
int zIndex = 0;
int cIndex = zIndex + 1;
int pIndex = cIndex + 1;
int ppIndex = pIndex + 1;
//
int loopback = 10;
//
string symbol = _symbol;
ENUM_TIMEFRAMES period = _period;
//
XOHCL zBar;
result = zBar.Init(
symbol,
period,
zIndex //
);
if (!result)
{
return result;
}
//
XOHCL cBar;
result = cBar.Init(
symbol,
period,
cIndex //
);
if (!result)
{
return result;
}
//
double ask = GetAsk(symbol);
double bid = GetBid(symbol);
datetime cTime = TimeCurrent();
//
double ll = cBar.FindLowest(9, MODE_LOW);
double hh = cBar.FindHighest(9, MODE_HIGH);
//
int zoneValidationDivider = 10;
int validPivotRepetition = triggerCycleHelper.mX121Helper
.GetDonChainLength();
//
double selectedSL = 0;
//
// Cycles Conditions ...
//
// Trigger ...
ENUM_XPOI_EVENTS triggerPoiEvents[];
ENUM_X_CYCLE_EVENTS triggerCycleEvents[];
X121SMCCycleConditions triggerConditions;
result = triggerCycleHelper.GetConditions(
triggerCycleEvents,
triggerPoiEvents,
triggerConditions,
zIndex,
loopback //
);
if (!result)
{
return result;
}
//
// Decision ...
ENUM_XPOI_EVENTS decisionPoiEvents[];
ENUM_X_CYCLE_EVENTS decisionCycleEvents[];
X121SMCCycleConditions decisionConditions;
result = decisionCycleHelper.GetConditions(
decisionCycleEvents,
decisionPoiEvents,
decisionConditions,
zIndex,
loopback //
);
if (!result)
{
return result;
}
//
// Analyse ...
ENUM_XPOI_EVENTS analysePoiEvents[];
ENUM_X_CYCLE_EVENTS analyseCycleEvents[];
X121SMCCycleConditions analyseConditions;
result = analyseCycleHelper.GetConditions(
analyseCycleEvents,
analysePoiEvents,
analyseConditions,
zIndex,
loopback //
);
if (!result)
{
return result;
}
//
// Verification ...
ENUM_XPOI_EVENTS verificationPoiEvents[];
ENUM_X_CYCLE_EVENTS verificationCycleEvents[];
X121SMCCycleConditions verificationConditions;
result = verificationCycleHelper.GetConditions(
verificationCycleEvents,
verificationPoiEvents,
verificationConditions,
zIndex,
loopback //
);
if (!result)
{
return result;
}
//
// Consolidation ...
ENUM_XPOI_EVENTS consolidationPoiEvents[];
ENUM_X_CYCLE_EVENTS consolidationCycleEvents[];
X121SMCCycleConditions consolidationConditions;
result = consolidationCycleHelper.GetConditions(
consolidationCycleEvents,
consolidationPoiEvents,
consolidationConditions,
zIndex,
loopback //
);
if (!result)
{
return result;
}
//
// Vision ...
ENUM_XPOI_EVENTS visionPoiEvents[];
ENUM_X_CYCLE_EVENTS visionCycleEvents[];
X121SMCCycleConditions visionConditions;
result = visionCycleHelper.GetConditions(
visionCycleEvents,
visionPoiEvents,
visionConditions,
zIndex,
loopback //
);
if (!result)
{
return result;
}
//
// Cycles POI States ...
XPOIState triggerState = triggerConditions.state;
XPOIState decisionState = decisionConditions.state;
XPOIState analyseState = analyseConditions.state;
XPOIState verificationState = verificationConditions.state;
XPOIState consolidationState = consolidationConditions.state;
XPOIState visionState = visionConditions.state;
//
// Trigger Conditions ...
//
isBullish =
//
false
//
;
//
isBearish =
//
false
//
;
//
result = isBullish ||
isBearish;
if (!result)
{
//
// Cleanup Setup Conditions ...
//
return result;
}
//
conditions.triggerTime = cTime;
conditions.sl = isBullish
? 0
: 0;
conditions.type = isBullish
? X_POSITION_TYPE_LONG
: X_POSITION_TYPE_SHORT;
//
return result;
}
//
//////////////////////////////////////////////////////////////////////////////////////////
//
// Test Signal ...
X121SMCStrategyTestSignalConditions mTestConditions;
bool DetectTestSignal(
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_XTEST;
string providerStr = ToString(provider);
//
// Detect Setup Conditions ...
datetime setupTime = mTestConditions.setupTime;
bool isSetuped = mTestConditions.IsSetuped();
ENUM_X_DIRECTION setupDir = mTestConditions.dir;
if (!isSetuped)
{
//
// Detect Signal Setup ...
isSetuped = DetectX121SMCTestSiganlSetup(
symbol,
period,
mTestConditions,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
//
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);
// }
// }
//
result = isSetuped;
if (!result)
{
return result;
}
//
// Detect Trigger Conditions ...
bool canTrigger = mTestConditions.CanTrigger();
datetime triggerTime = mTestConditions.triggerTime;
if (!canTrigger)
{
//
// Detect Signal Trigger ...
canTrigger = DetectX121SMCTestSiganlTrigger(
mTestConditions,
symbol,
period,
mTriggerCycleHelper,
mDecisionCycleHelper,
mAnalyseCycleHelper,
mVerificationCycleHelper,
mConsolidationCycleHelper,
mVisionCycleHelper //
);
//
result = canTrigger;
if (!result)
{
return result;
}
//
triggerTime = mTestConditions.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 = mTestConditions.sl;
//
mTestConditions.Clean();
//
return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
+13 -1
View File
@@ -377,7 +377,15 @@ class XCZone : public XCBasePOI
*/
bool IsValidFrom()
{
return IsSpecifiedValid(From());
//
bool result = false;
//
datetime from = From();
result = IsSpecifiedValid(from);
//
return result;
}
//
@@ -2822,6 +2830,10 @@ class XCTicksZone : public XCTwoBarZone
//
result = IsValid();
if (!result)
{
return result;
}
//
// Try to Find Out PERIOD_1M times in each zone ...
@@ -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: