This commit is contained in:
2025-01-03 20:25:00 +03:30
parent 5f2a2f822e
commit a9ab5a6258
10 changed files with 8609 additions and 4449 deletions
+118 -57
View File
@@ -22,6 +22,7 @@
//
// Imports ...
#include "../../Classes/x-saherelm.base.class.mq5"
#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5"
#include "../../Helpers/x-saherelm.x121.helper.mq5"
#include "../../Libraries/x-saherelm.common.lib.mq5"
#include "../../Libraries/x-saherelm.x-poi.lib.mq5"
@@ -35,12 +36,7 @@ const string X121SMCStrategyToken = "X121SMC";
//
const string X121SMCXTestToken = "X121XTest";
const string X121SMCXPVOBToken = "X121XPVOB";
const string X121SMCXPVDPToken = "X121XPVDP";
const string X121SMCXVWPBToken = "X121XVWPB";
const string X121SMCXTWPVToken = "X121XTWPV";
const string X121SMCXOEPVToken = "X121XOEPV";
const string X121SMCXPVSupDemToken = "X121XPVSUPDEM";
//
// X121 SMC Providers ...
@@ -49,12 +45,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_XPVDP,
X_121_SMC_PROVIDER_XVWPB,
X_121_SMC_PROVIDER_XTWPV,
X_121_SMC_PROVIDER_XOEPV,
X_121_SMC_PROVIDER_XPVSUPDEM,
};
//
@@ -264,9 +255,11 @@ struct X121SMCStrategyConditions
double target;
string provider;
ENUM_X_DIRECTION signalDir;
ENUM_X_DIRECTION marketStructureDir;
//
XPriceZones priceZones;
XPriceZones decisionZones;
XMarketStructure marketStructure;
//
void X121SMCStrategyConditions()
@@ -292,7 +285,11 @@ struct X121SMCStrategyConditions
tp = 0;
provider = NULL;
signalDir = X_DIRECTION_NONE;
marketStructureDir = X_DIRECTION_NONE;
//
priceZones.Clean();
decisionZones.Clean();
marketStructure.Clean();
}
/**
@@ -503,6 +500,115 @@ struct X121SMCStrategyConditions
//
};
/**
* Draw X121 SMC Conditions ...
*
* @param conditions: X121SMCStrategyConditions instance Reference ...
* @param drawMarketStructure: Boolean ...
* @param drawPriceZones: Boolean ...
* @param drawDecisionZones: Boolean ...
*
* @return ( int )
*/
int DrawX121SMCStrategyConditions(
X121SMCStrategyConditions &conditions,
XCBaseObject *&drawnObjects[],
XCPOIDrawer *drawer,
bool drawMarketStructure = true,
bool drawPriceZones = true,
bool drawDecisionZones = true //
)
{
//
int result = 0;
//
Clean(drawnObjects);
//
if (drawer == NULL ||
!conditions.IsValid() ||
!HasDirection(conditions.signalDir))
{
return result;
}
//
bool isBullish = IsBullish(conditions.signalDir);
//
bool hasPriceZones = conditions.priceZones.IsValid();
if (hasPriceZones &&
drawPriceZones)
{
//
XCBaseObject *objects[];
int objectsCount = drawer.DrawPriceZone(
conditions.priceZones,
objects //
);
if (IsValidSize(objectsCount))
{
//
Copy(
objects,
drawnObjects,
false //
);
}
}
//
bool hasDecisionZones = conditions.decisionZones.IsValid();
if (hasDecisionZones &&
drawDecisionZones)
{
//
XCBaseObject *objects[];
int objectsCount = drawer.DrawPriceZone(
conditions.decisionZones,
objects //
);
if (IsValidSize(objectsCount))
{
//
Copy(
objects,
drawnObjects,
false //
);
}
}
//
bool hasMarketStructure = conditions.marketStructure.IsValid();
if (hasMarketStructure &&
drawMarketStructure)
{
//
XCBaseObject *objects[];
int objectsCount = drawer.DrawMarketStructure(
conditions.marketStructure,
objects //
);
if (IsValidSize(objectsCount))
{
//
Copy(
objects,
drawnObjects,
false //
);
}
}
//
result = ArraySize(drawnObjects);
//
return result;
}
//
//
//
@@ -560,35 +666,10 @@ string ToString(ENUM_X_121_SMC_PROVIDERS value)
result = X121SMCXTestToken;
break;
//
case X_121_SMC_PROVIDER_XPVOB:
result = X121SMCXPVOBToken;
break;
//
case X_121_SMC_PROVIDER_XPVDP:
result = X121SMCXPVDPToken;
break;
//
case X_121_SMC_PROVIDER_XVWPB:
result = X121SMCXVWPBToken;
break;
//
case X_121_SMC_PROVIDER_XTWPV:
result = X121SMCXTWPVToken;
break;
//
case X_121_SMC_PROVIDER_XOEPV:
result = X121SMCXOEPVToken;
break;
//
case X_121_SMC_PROVIDER_XPVSUPDEM:
result = X121SMCXPVSupDemToken;
break;
}
//
@@ -618,30 +699,10 @@ ENUM_X_121_SMC_PROVIDERS ParseProvider(string value)
{
result = X_121_SMC_PROVIDER_XTEST;
}
else if (Contains(X121SMCXPVOBToken, value))
{
result = X_121_SMC_PROVIDER_XPVOB;
}
else if (Contains(X121SMCXPVDPToken, value))
{
result = X_121_SMC_PROVIDER_XPVDP;
}
else if (Contains(X121SMCXVWPBToken, value))
{
result = X_121_SMC_PROVIDER_XVWPB;
}
else if (Contains(X121SMCXTWPVToken, value))
{
result = X_121_SMC_PROVIDER_XTWPV;
}
else if (Contains(X121SMCXOEPVToken, value))
{
result = X_121_SMC_PROVIDER_XOEPV;
}
else if (Contains(X121SMCXPVSupDemToken, value))
{
result = X_121_SMC_PROVIDER_XPVSUPDEM;
}
//
return result;