Last Works On Test ...

This commit is contained in:
2024-11-04 01:36:42 +03:30
parent 13e880f25c
commit 43dd4268ab
7 changed files with 929 additions and 3 deletions
+1 -1
View File
@@ -2207,7 +2207,7 @@ class XCPOIDrawer : public XSCBase
//
string name = zone.GetTag();
result = Contains(
ToString(X_POI_BEARISH_ORDERBLOCK),
ToString(X_POI_BEARISH_FVG),
name //
);
if (!result)
+836
View File
@@ -0,0 +1,836 @@
//
// Draw Functions ...
/**
* Draw Specific Condition ...
*
* @param conditions: X121SMCStrategyConditions instance ...
*/
void DrawConditions(X121SMCStrategyConditions &conditions)
{
//
// Draw Configurations ...
//
bool drawMainDemand = true;
bool drawMainSupply = true;
//
bool drawMainBullishOrderBlock = true;
bool drawMainBearishOrderBlock = true;
//
bool drawMainBullishFVG = true;
bool drawMainBearishFVG = true;
//
bool drawOrderBlocks = false;
bool drawFVGs = false;
bool drawSupportResistances = false;
bool drawSwings = false;
bool drawMomentumBars = false;
bool drawRejectionBars = false;
//
if (!conditions.IsValid())
{
return;
}
//
datetime time = TimeCurrent();
bool hasValidDemand = conditions.ValidateDemand();
bool hasValidSupply = conditions.ValidateSupply();
if (!hasValidDemand && !hasValidSupply)
{
return;
}
//
// Demand Zone ...
if (hasValidDemand)
{
//
// Demand ...
if (drawMainDemand)
{
//
XCDemandZoneObject *iObj;
bool isCreated = mPOIDrawer.CreateDemandZone(
conditions.demandZone,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
//
if (drawMainBullishOrderBlock)
{
//
XCBullishOrderBlockObject *iObj;
bool isCreated = mPOIDrawer.CreateBullishOrderBlock(
conditions.bullishOrderBlock,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
//
if (drawMainBullishFVG)
{
//
XCBullishFVGObject *iObj;
bool isCreated = mPOIDrawer.CreateBullishFVG(
conditions.bullishFVG,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
//
// Order Blocks ...
int obsCount = ArraySize(conditions.bullishOrderBlocks);
if (drawOrderBlocks &&
IsValidSize(obsCount))
{
//
for (int i = 0; i < obsCount; i++)
{
//
XZone iZone = conditions.bullishOrderBlocks[i];
//
XCBullishOrderBlockObject *iObj;
bool isCreated = mPOIDrawer.CreateBullishOrderBlock(
iZone,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
}
//
// Fair Value Gaps ...
int fvgsCount = ArraySize(conditions.bullishFVGs);
if (drawFVGs &&
IsValidSize(fvgsCount))
{
//
for (int i = 0; i < fvgsCount; i++)
{
//
XZone iZone = conditions.bullishFVGs[i];
//
XCBullishFVGObject *iObj;
bool isCreated = mPOIDrawer.CreateBullishFVG(
iZone,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
}
//
// Supports ...
int supportsCount = ArraySize(conditions.supports);
if (drawSupportResistances &&
IsValidSize(supportsCount))
{
//
for (int i = 0; i < supportsCount; i++)
{
//
XOHCL iBar = conditions.supports[i];
//
XCSupportZoneObject *iObj;
bool isCreated = mPOIDrawer.CreateSupportZone(
iBar,
iObj,
time //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
}
//
// Swings ...
int swingsCount = ArraySize(conditions.swingLows);
if (drawSwings &&
IsValidSize(swingsCount))
{
//
for (int i = 0; i < swingsCount; i++)
{
//
XOHCL iBar = conditions.swingLows[i];
//
XCSwingLowObject *iObj;
bool isCreated = mPOIDrawer.CreateSwingLow(
iBar,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
}
//
// Momentum Bars ...
int momentumBarsCount = ArraySize(conditions.bullishMomentumBars);
if (drawMomentumBars &&
IsValidSize(momentumBarsCount))
{
//
for (int i = 0; i < momentumBarsCount; i++)
{
//
XOHCL iBar = conditions.bullishMomentumBars[i];
//
XCBullishMomentumBarObject *iObj;
bool isCreated = mPOIDrawer.CreateBullishMomentumBar(
iBar,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
}
//
// Rejection Bars ...
int rejectionBarsCount = ArraySize(conditions.bullishRejectionBars);
if (drawRejectionBars &&
IsValidSize(rejectionBarsCount))
{
//
for (int i = 0; i < rejectionBarsCount; i++)
{
//
XOHCL iBar = conditions.bullishRejectionBars[i];
//
XCBullishRejectionBarObject *iObj;
bool isCreated = mPOIDrawer.CreateBullishRejectionBar(
iBar,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
}
}
//
// Supply Zone ...
if (hasValidSupply)
{
//
// Supply ...
if (drawMainSupply)
{
//
XCSupplyZoneObject *iObj;
bool isCreated = mPOIDrawer.CreateSupplyZone(
conditions.supplyZone,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
//
if (drawMainBearishOrderBlock)
{
//
XCBearishOrderBlockObject *iObj;
bool isCreated = mPOIDrawer.CreateBearishOrderBlock(
conditions.bearishOrderBlock,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
//
if (drawMainBearishFVG)
{
//
XCBearishFVGObject *iObj;
bool isCreated = mPOIDrawer.CreateBearishFVG(
conditions.bearishFVG,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
//
// Order Blocks ...
int obsCount = ArraySize(conditions.bearishOrderBlocks);
if (drawOrderBlocks &&
IsValidSize(obsCount))
{
//
for (int i = 0; i < obsCount; i++)
{
//
XZone iZone = conditions.bearishOrderBlocks[i];
//
XCBearishOrderBlockObject *iObj;
bool isCreated = mPOIDrawer.CreateBearishOrderBlock(
iZone,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
}
//
// Fair Value Gaps ...
int fvgsCount = ArraySize(conditions.bearishFVGs);
if (drawFVGs &&
IsValidSize(fvgsCount))
{
//
for (int i = 0; i < fvgsCount; i++)
{
//
XZone iZone = conditions.bearishFVGs[i];
//
XCBearishFVGObject *iObj;
bool isCreated = mPOIDrawer.CreateBearishFVG(
iZone,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
}
//
// Resistances ...
int resistancesCount = ArraySize(conditions.resistances);
if (drawSupportResistances &&
IsValidSize(resistancesCount))
{
//
for (int i = 0; i < resistancesCount; i++)
{
//
XOHCL iBar = conditions.resistances[i];
//
XCResistanceZoneObject *iObj;
bool isCreated = mPOIDrawer.CreateResistanceZone(
iBar,
iObj,
time //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
}
//
// Swings ...
int swingsCount = ArraySize(conditions.swingHighs);
if (drawSwings &&
IsValidSize(swingsCount))
{
//
for (int i = 0; i < swingsCount; i++)
{
//
XOHCL iBar = conditions.swingHighs[i];
//
XCSwingHighObject *iObj;
bool isCreated = mPOIDrawer.CreateSwingHigh(
iBar,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
}
//
// Momentum Bars ...
int momentumBarsCount = ArraySize(conditions.bearishMomentumBars);
if (drawMomentumBars &&
IsValidSize(momentumBarsCount))
{
//
for (int i = 0; i < momentumBarsCount; i++)
{
//
XOHCL iBar = conditions.bearishMomentumBars[i];
//
XCBearishMomentumBarObject *iObj;
bool isCreated = mPOIDrawer.CreateBearishMomentumBar(
iBar,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
}
//
// Rejection Bars ...
int rejectionBarsCount = ArraySize(conditions.bearishRejectionBars);
if (drawRejectionBars &&
IsValidSize(rejectionBarsCount))
{
//
for (int i = 0; i < rejectionBarsCount; i++)
{
//
XOHCL iBar = conditions.bearishRejectionBars[i];
//
XCBearishRejectionBarObject *iObj;
bool isCreated = mPOIDrawer.CreateBearishRejectionBar(
iBar,
iObj //
);
if (isCreated)
{
mDrawnObjects.Add(iObj);
}
}
}
}
}
/**
* Draw Specified Market Struture ...
*
* @param structure: X121SMCMarketStructure instance ...
*/
void DrawMarketStructure(
X121SMCMarketStructure &structure,
ENUM_X_POSITION_TYPES type = X_POSITION_TYPE_ALL //
)
{
//
datetime cTime = TimeCurrent();
//
bool canAll = type == X_POSITION_TYPE_ALL;
bool canLong = type == X_POSITION_TYPE_LONG;
bool canShort = type == X_POSITION_TYPE_SHORT;
//
// Supply Zones ...
int supplysCount = ArraySize(structure.supplyZones);
if ((canAll || canLong) && IsValidSize(supplysCount))
{
//
for (int i = 0; i < supplysCount; i++)
{
//
XZone iZone = structure.supplyZones[i];
//
XCSupplyZoneObject *iObj;
bool isCreated = mPOIDrawer.CreateSupplyZone(
iZone,
iObj //
);
if (isCreated)
{
//
mDrawnObjects.Add(iObj);
}
}
}
//
// Demand Zones ...
int demandsCount = ArraySize(structure.demandZones);
if ((canAll || canShort) && IsValidSize(demandsCount))
{
//
for (int i = 0; i < demandsCount; i++)
{
//
XZone iZone = structure.demandZones[i];
//
XCDemandZoneObject *iObj;
bool isCreated = mPOIDrawer.CreateDemandZone(
iZone,
iObj //
);
if (isCreated)
{
//
mDrawnObjects.Add(iObj);
}
}
}
//
// Order Blocks ...
//
// Bullish OBs ...
int bullishOBsCount = ArraySize(structure.bullishOrderBlocks);
if ((canAll || canShort) && IsValidSize(bullishOBsCount))
{
//
for (int i = 0; i < bullishOBsCount; i++)
{
//
XZone iZone = structure.bullishOrderBlocks[i];
//
XCBullishOrderBlockObject *iObj;
bool isCreated = mPOIDrawer.CreateBullishOrderBlock(
iZone,
iObj //
);
if (isCreated)
{
//
mDrawnObjects.Add(iObj);
}
}
}
//
// Bearish OBs ...
int bearishOBsCount = ArraySize(structure.bearishOrderBlocks);
if ((canAll || canLong) && IsValidSize(bearishOBsCount))
{
//
for (int i = 0; i < bearishOBsCount; i++)
{
//
XZone iZone = structure.bearishOrderBlocks[i];
//
XCBearishOrderBlockObject *iObj;
bool isCreated = mPOIDrawer.CreateBearishOrderBlock(
iZone,
iObj //
);
if (isCreated)
{
//
mDrawnObjects.Add(iObj);
}
}
}
//
// Fair Value Gaps ...
//
// Bullish FVGs ...
int bullishFVGsCount = ArraySize(structure.bullishFVGs);
if ((canAll || canShort) && IsValidSize(bullishFVGsCount))
{
//
for (int i = 0; i < bullishFVGsCount; i++)
{
//
XZone iZone = structure.bullishFVGs[i];
//
XCBullishFVGObject *iObj;
bool isCreated = mPOIDrawer.CreateBullishFVG(
iZone,
iObj //
);
if (isCreated)
{
//
mDrawnObjects.Add(iObj);
}
}
}
//
// Bearish FVGs ...
int bearishFVGsCount = ArraySize(structure.bearishFVGs);
if ((canAll || canLong) && IsValidSize(bearishFVGsCount))
{
//
for (int i = 0; i < bearishFVGsCount; i++)
{
//
XZone iZone = structure.bearishFVGs[i];
//
XCBearishFVGObject *iObj;
bool isCreated = mPOIDrawer.CreateBearishFVG(
iZone,
iObj //
);
if (isCreated)
{
//
mDrawnObjects.Add(iObj);
}
}
}
//
// Swing Highs ...
int swingHighsCount = ArraySize(structure.swingHighs);
if ((canAll || canLong) && IsValidSize(swingHighsCount))
{
//
for (int i = 0; i < swingHighsCount; i++)
{
//
XOHCL iBar = structure.swingHighs[i];
//
XCSwingHighObject *iObj;
bool isCreated = mPOIDrawer.CreateSwingHigh(
iBar,
iObj //
);
if (isCreated)
{
//
mDrawnObjects.Add(iObj);
}
}
}
//
// Swing Lows ...
int swingLowsCount = ArraySize(structure.swingLows);
if ((canAll || canShort) && IsValidSize(swingLowsCount))
{
//
for (int i = 0; i < swingLowsCount; i++)
{
//
XOHCL iBar = structure.swingLows[i];
//
XCSwingLowObject *iObj;
bool isCreated = mPOIDrawer.CreateSwingLow(
iBar,
iObj //
);
if (isCreated)
{
//
mDrawnObjects.Add(iObj);
}
}
}
//
// Support Zones ...
int supportsCount = ArraySize(structure.supports);
if ((canAll || canShort) && IsValidSize(supportsCount))
{
//
for (int i = 0; i < supportsCount; i++)
{
//
XOHCL iBar = structure.supports[i];
//
XCSupportZoneObject *iObj;
bool isCreated = mPOIDrawer.CreateSupportZone(
iBar,
iObj,
cTime //
);
if (isCreated)
{
//
mDrawnObjects.Add(iObj);
}
}
}
//
// Resistance Zones ...
int resistancesCount = ArraySize(structure.resistances);
if ((canAll || canLong) && IsValidSize(resistancesCount))
{
//
for (int i = 0; i < resistancesCount; i++)
{
//
XOHCL iBar = structure.resistances[i];
//
XCResistanceZoneObject *iObj;
bool isCreated = mPOIDrawer.CreateResistanceZone(
iBar,
iObj,
cTime //
);
if (isCreated)
{
//
mDrawnObjects.Add(iObj);
}
}
}
//
// Momentum Bars ...
//
// Bullish Momentum Bars ...
int momentumBarCount = ArraySize(structure.bullishMomentumBars);
if ((canAll || canShort) && IsValidSize(momentumBarCount))
{
//
for (int i = 0; i < momentumBarCount; i++)
{
//
XOHCL iBar = structure.bullishMomentumBars[i];
//
XCBullishMomentumBarObject *iObj;
bool isCreated = mPOIDrawer.CreateBullishMomentumBar(
iBar,
iObj //
);
if (isCreated)
{
//
mDrawnObjects.Add(iObj);
}
}
}
//
// Bearish Momentum Bars ...
momentumBarCount = ArraySize(structure.bearishMomentumBars);
if ((canAll || canLong) && IsValidSize(momentumBarCount))
{
//
for (int i = 0; i < momentumBarCount; i++)
{
//
XOHCL iBar = structure.bearishMomentumBars[i];
//
XCBearishMomentumBarObject *iObj;
bool isCreated = mPOIDrawer.CreateBearishMomentumBar(
iBar,
iObj //
);
if (isCreated)
{
//
mDrawnObjects.Add(iObj);
}
}
}
//
// Rejection Bars ...
//
// Bullish Rejection Bars ...
int rejectionBarCount = ArraySize(structure.bullishRejectionBars);
if ((canAll || canShort) && IsValidSize(rejectionBarCount))
{
//
for (int i = 0; i < rejectionBarCount; i++)
{
//
XOHCL iBar = structure.bullishRejectionBars[i];
//
XCBullishRejectionBarObject *iObj;
bool isCreated = mPOIDrawer.CreateBullishRejectionBar(
iBar,
iObj //
);
if (isCreated)
{
//
mDrawnObjects.Add(iObj);
}
}
}
//
// Bearish Rejection Bars ...
rejectionBarCount = ArraySize(structure.bearishRejectionBars);
if ((canAll || canLong) && IsValidSize(rejectionBarCount))
{
//
for (int i = 0; i < rejectionBarCount; i++)
{
//
XOHCL iBar = structure.bearishRejectionBars[i];
//
XCBearishRejectionBarObject *iObj;
bool isCreated = mPOIDrawer.CreateBearishRejectionBar(
iBar,
iObj //
);
if (isCreated)
{
//
mDrawnObjects.Add(iObj);
}
}
}
}
+2 -1
View File
@@ -7874,9 +7874,10 @@ double GetPriceChanged(
{
return result;
}
ArrayReverse(closes);
//
double change = (closes[0] - closes[5]) / closes[5] * 100;
double change = (closes[0] - closes[_length - 1]) / closes[_length - 1] * 100;
result = change;
//
+80
View File
@@ -1915,6 +1915,86 @@ bool IsBetween(
return result;
}
/**
* Check Source breaked Dest from Upper ...
*
* @param source: XZone instance ...
* @param dest: XZone instance ...
*
* @return ( bool )
*/
bool IsBreakeUpper(
XZone &source,
XZone &dest //
)
{
//
bool result = false;
//
result = source.IsValid() &&
dest.IsValid();
if (!result)
{
return result;
}
//
result =
//
// Check Boundary ...
source.lower <= dest.upper &&
source.lower >= dest.lower &&
//
// Check Break ...
source.upper > dest.upper
//
;
//
return result;
}
/**
* Check Source breaked Dest from Lower ...
*
* @param source: XZone instance ...
* @param dest: XZone instance ...
*
* @return ( bool )
*/
bool IsBreakeLower(
XZone &source,
XZone &dest //
)
{
//
bool result = false;
//
result = source.IsValid() &&
dest.IsValid();
if (!result)
{
return result;
}
//
result =
//
// Check Boundary ...
source.upper <= dest.upper &&
source.upper >= dest.lower &&
//
// Check Break ...
source.lower < dest.lower
//
;
//
return result;
}
//
// State Extensions ...
@@ -829,6 +829,7 @@ class XC121SMCExpert : public XCBaseExpert
// Confiugre Signalling ...
//
strategy.R2R(2);
strategy.AllowLong(AllowLong());
strategy.AllowShort(AllowShort());
+9 -1
View File
@@ -56,6 +56,7 @@ struct X121SMCStrategyConditions
//
XZone supplyZone;
XZone bearishOrderBlock;
XZone bearishFVG;
//
XZone bearishOrderBlocks[];
@@ -70,6 +71,7 @@ struct X121SMCStrategyConditions
//
XZone demandZone;
XZone bullishOrderBlock;
XZone bullishFVG;
//
XZone bullishOrderBlocks[];
@@ -102,6 +104,7 @@ struct X121SMCStrategyConditions
//
supplyZone.Clean();
bearishFVG.Clean();
bearishOrderBlock.Clean();
//
@@ -110,7 +113,8 @@ struct X121SMCStrategyConditions
//
demandZone.Clean();
bearishOrderBlock.Clean();
bullishFVG.Clean();
bullishOrderBlock.Clean();
//
Clean(bullishFVGs);
@@ -133,6 +137,7 @@ struct X121SMCStrategyConditions
{
//
demandZone.Clean();
bullishFVG.Clean();
bullishOrderBlock.Clean();
//
@@ -148,6 +153,7 @@ struct X121SMCStrategyConditions
{
//
supplyZone.Clean();
bearishFVG.Clean();
bearishOrderBlock.Clean();
//
@@ -175,6 +181,7 @@ struct X121SMCStrategyConditions
result =
//
supplyZone.IsValid() &&
bearishFVG.IsValid() &&
bearishOrderBlock.IsValid() &&
(ArraySize(swingHighs) > 0 ||
ArraySize(bearishFVGs) > 0 ||
@@ -205,6 +212,7 @@ struct X121SMCStrategyConditions
result =
//
demandZone.IsValid() &&
bullishFVG.IsValid() &&
bullishOrderBlock.IsValid() &&
(ArraySize(supports) > 0 ||
ArraySize(swingLows) > 0 ||
Binary file not shown.