This commit is contained in:
2024-12-11 04:58:55 +03:30
parent a64430a28c
commit db5144b1ef
4 changed files with 367 additions and 195 deletions
@@ -468,6 +468,111 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
double bid = GetBid(symbol);
datetime cTime = TimeCurrent();
//
int consolidationsCount = mTriggerCycleHelper.CountConsolidationZones();
result = IsValidSize(consolidationsCount);
if (!result)
{
//
conditions.Clean();
return result;
}
XConsolidationZone consolidations[];
mTriggerCycleHelper.FillConsolidationZones(consolidations);
//
// Detect Bid inside Of Zones ...
bool hasSupply = false;
bool hasDemand = false;
XCSupplyZone *supplyZone;
XCDemandZone *demandZone;
bool isBidInsideZone = false;
XConsolidationZone bidContainsConsolidationZone;
for (int i = consolidationsCount - 1; i >= 0; i--)
{
//
XConsolidationZone iZone = consolidations[i];
//
// Check Supply or Demand Zone ...
hasSupply = iZone.HasSupplyZone(supplyZone);
hasDemand = iZone.HasDemandZone(demandZone);
//
result = hasSupply ||
hasDemand;
if (!result)
{
continue;
}
//
// Check Bid inside Zone ...
if (hasSupply)
{
//
result = bid < supplyZone.Upper() &&
bid > supplyZone.Lower();
}
else
{
//
result = bid < demandZone.Upper() &&
bid > demandZone.Lower();
}
//
if (result)
{
break;
}
}
if (!result)
{
//
conditions.Clean();
return result;
}
//
if (hasSupply)
{
//
supplyZone.To(cTime);
XCSupplyZoneObject *iSupplyZoneObj;
result = mPOIDrawer.CreateSupplyZone(
supplyZone,
iSupplyZoneObj //
);
if (!result)
{
//
conditions.Clean();
return result;
}
}
//
if (hasDemand)
{
//
demandZone.To(cTime);
XCDemandZoneObject *iDemandZoneObj;
result = mPOIDrawer.CreateDemandZone(
demandZone,
iDemandZoneObj //
);
if (!result)
{
//
conditions.Clean();
return result;
}
}
//
Print("BID Inside Zone ...");
//
if (!result)
{