This commit is contained in:
2025-01-02 13:24:37 +03:30
parent 1c169cebe2
commit 410c6793ae
8 changed files with 795 additions and 266 deletions
+428
View File
@@ -2923,6 +2923,434 @@ class XCPOIDrawer : public XCBase
return result;
}
/**
* Draw Price Zone ...
*
* @param zone: XPriceZones instance Reference ...
* @param forDir: ENUM_X_DIRECTION member ...
*
* @return ( int )
*/
int DrawPriceZone(
XPriceZones &zone,
XCBaseObject *&drawnObjects[],
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = 0;
//
Clean(drawnObjects);
//
if (!zone.IsValid())
{
return result;
}
//
bool isBullish = IsBullish(forDir);
bool isAll = forDir == X_DIRECTION_ALL ||
forDir == X_DIRECTION_NONE;
//
if (isAll || isBullish)
{
//
// Support Zone ...
if (zone.HasSupportZone())
{
//
XCSupportZoneObject *iObj;
bool isCreated = CreateSupportZone(
zone.supportZone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
// Demand Zone ...
if (zone.HasDemandZone())
{
//
XCDemandZoneObject *iObj;
bool isCreated = CreateDemandZone(
zone.demandZone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
// OrderBlock ...
if (zone.HasOrderBlock() &&
zone.orderBlock.IsBullish())
{
//
XCBullishOrderBlockObject *iObj;
bool isCreated = CreateBullishOrderBlock(
zone.orderBlock,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
// FairValueGap ...
if (zone.HasFairValueGap() &&
zone.fairValueGap.IsBullish())
{
//
XCBullishFairValueGapObject *iObj;
bool isCreated = CreateBullishFairValueGap(
zone.fairValueGap,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
//
if (isAll || !isBullish)
{
//
// Resistance Zone ...
if (zone.HasResistanceZone())
{
//
XCResistanceZoneObject *iObj;
bool isCreated = CreateResistanceZone(
zone.resistanceZone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
// Supply Zone ...
if (zone.HasSupplyZone())
{
//
XCSupplyZoneObject *iObj;
bool isCreated = CreateSupplyZone(
zone.supplyZone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
// OrderBlock ...
if (zone.HasOrderBlock() &&
zone.orderBlock.IsBearish())
{
//
XCBearishOrderBlockObject *iObj;
bool isCreated = CreateBearishOrderBlock(
zone.orderBlock,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
// FairValueGap ...
if (zone.HasFairValueGap() &&
zone.fairValueGap.IsBearish())
{
//
XCBearishFairValueGapObject *iObj;
bool isCreated = CreateBearishFairValueGap(
zone.fairValueGap,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
//
result = ArraySize(drawnObjects);
//
return result;
}
/**
* Draw Specified Market Structure ...
*
* @param model: XMarketStructure instance Reference ...
*
* @return ( int )
*/
int DrawMarketStructure(
XMarketStructure &model,
XCBaseObject *&drawnObjects[] //
)
{
//
int result = 0;
//
Clean(drawnObjects);
//
datetime cTime = TimeCurrent();
//
bool isValid =
model.IsValid();
if (!isValid)
{
return result;
}
//
if (model.lowestValeBar.IsValid())
{
//
XCOHCLObject *iObj;
bool isCreated = CreateBar(
model.lowestValeBar,
iObj //
);
//
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
if (model.lowestValePeakBreakeUpBar.IsValid())
{
//
XCOHCLObject *iObj;
bool isCreated = CreateBar(
model.lowestValePeakBreakeUpBar,
iObj //
);
//
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
if (model.valeAboveLowestValePeakBar.IsValid())
{
//
XCOHCLObject *iObj;
bool isCreated = CreateBar(
model.valeAboveLowestValePeakBar,
iObj //
);
//
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
if (model.highestPeakBar.IsValid())
{
//
XCOHCLObject *iObj;
bool isCreated = CreateBar(
model.highestPeakBar,
iObj //
);
//
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
if (model.peakBelowHighestPeakValeBar.IsValid())
{
//
XCOHCLObject *iObj;
bool isCreated = CreateBar(
model.peakBelowHighestPeakValeBar,
iObj //
);
//
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
if (model.highestPeakValeBreakeDownBar.IsValid())
{
//
XCOHCLObject *iObj;
bool isCreated = CreateBar(
model.highestPeakValeBreakeDownBar,
iObj //
);
//
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
if (HasChild(model.valePriceZones))
{
//
int count = ArraySize(model.valePriceZones);
for (int i = 0; i < count; i++)
{
//
XPriceZones ipZone = model.valePriceZones[i];
//
XCBaseObject *ipObjects[];
int ipDrawnObjects = DrawPriceZone(
ipZone,
ipObjects //
);
if (IsValidSize(ipObjects))
{
//
Copy(
ipObjects,
drawnObjects,
false //
);
}
}
}
//
if (HasChild(model.peakPriceZones))
{
//
int count = ArraySize(model.peakPriceZones);
for (int i = 0; i < count; i++)
{
//
XPriceZones ipZone = model.peakPriceZones[i];
//
XCBaseObject *ipObjects[];
int ipDrawnObjects = DrawPriceZone(
ipZone,
ipObjects //
);
if (IsValidSize(ipObjects))
{
//
Copy(
ipObjects,
drawnObjects,
false //
);
}
}
}
//
result = ArraySize(drawnObjects);
//
return result;
}
/**
* Draw Specified POI State ...
*