This commit is contained in:
2025-02-19 00:16:57 +03:30
parent 6ab805765c
commit 8bb5a6cb06
4 changed files with 644 additions and 107 deletions
+333
View File
@@ -4330,6 +4330,339 @@ class XCPOIDrawer : public XCBase
return result;
}
//
int DrawOBFVG(
XOBFVG &item,
XCBaseObject *&objects[],
//
bool drawOrderBlock = true,
bool drawFairValueGap = true,
bool drawSupplyZones = true,
bool drawDemandZones = true,
bool drawSupportZones = true,
bool drawResistanceZones = true,
//
bool drawOBStartedBar = true,
bool drawOBActivatedBar = true,
bool drawOBBreakedBar = true,
bool drawOBWorkedBar = true,
//
bool drawFVGStartedBar = true,
bool drawFVGActivatedBar = true,
bool drawFVGBreakedBar = true,
bool drawFVGWorkedBar = true,
//
// Order Block Specs ...
//
int widthOBStartedBar = 1,
color clrOBStartedBar = clrYellow,
ENUM_LINE_STYLE styleOBStartedBar = STYLE_SOLID,
//
int widthOBActivatedBar = 1,
color clrOBActivatedBar = clrLime,
ENUM_LINE_STYLE styleOBActivatedBar = STYLE_SOLID,
//
int widthOBBreakedBar = 1,
color clrOBBreakedBar = clrRed,
ENUM_LINE_STYLE styleOBBreakedBar = STYLE_SOLID,
//
int widthOBWorkedBar = 1,
color clrOBWorkedBar = clrAqua,
ENUM_LINE_STYLE styleOBWorkedBar = STYLE_SOLID,
//
// Fair Value Gap Specs ...
//
int widthFVGStartedBar = 1,
color clrFVGStartedBar = clrYellow,
ENUM_LINE_STYLE styleFVGStartedBar = STYLE_SOLID,
//
int widthFVGActivatedBar = 1,
color clrFVGActivatedBar = clrLime,
ENUM_LINE_STYLE styleFVGActivatedBar = STYLE_SOLID,
//
int widthFVGBreakedBar = 1,
color clrFVGBreakedBar = clrRed,
ENUM_LINE_STYLE styleFVGBreakedBar = STYLE_SOLID,
//
int widthFVGWorkedBar = 1,
color clrFVGWorkedBar = clrAqua,
ENUM_LINE_STYLE styleFVGWorkedBar = STYLE_SOLID
//
)
{
//
int result = 0;
//
Clean(objects);
//
bool isValid = item.IsValid();
if (!isValid)
{
return result;
}
//
int count = 0;
bool has = false;
bool isCreated = false;
XCBaseObject *tmpObjects[];
//
// Order Block ...
has = item.HasOB();
if (has &&
drawOrderBlock)
{
//
Clean(tmpObjects);
count = DrawOrderBlock(
item.ob,
tmpObjects,
drawOBStartedBar,
drawOBActivatedBar,
drawOBBreakedBar,
drawOBWorkedBar,
widthOBStartedBar,
clrOBStartedBar,
styleOBStartedBar,
widthOBActivatedBar,
clrOBActivatedBar,
styleOBActivatedBar,
widthOBBreakedBar,
clrOBBreakedBar,
styleOBBreakedBar,
widthOBWorkedBar,
clrOBWorkedBar,
styleOBWorkedBar //
);
has = IsValidSize(count);
if (has)
{
//
Copy(
tmpObjects,
objects,
false //
);
}
}
//
// Fair Value Gap ...
has = item.HasFVG();
if (has &&
drawFairValueGap)
{
//
Clean(tmpObjects);
count = DrawFairValueGap(
item.fvg,
tmpObjects,
drawFVGStartedBar,
drawFVGActivatedBar,
drawFVGBreakedBar,
drawFVGWorkedBar,
widthFVGStartedBar,
clrFVGStartedBar,
styleFVGStartedBar,
widthFVGActivatedBar,
clrFVGActivatedBar,
styleFVGActivatedBar,
widthFVGBreakedBar,
clrFVGBreakedBar,
styleFVGBreakedBar,
widthFVGWorkedBar,
clrFVGWorkedBar,
styleFVGWorkedBar //
);
has = IsValidSize(count);
if (has)
{
//
Copy(
tmpObjects,
objects,
false //
);
}
}
//
// Supply Zones ...
has = item.HasSupplyZones();
if (has &&
drawSupplyZones)
{
//
Clean(tmpObjects);
count = item.CountSupplyZones();
for (int i = 0; i < count; i++)
{
//
XCSupplyZoneObject *iZoneObj;
has = CreateSupplyZone(
item.supplyZones[i],
iZoneObj //
);
if (has)
{
//
Add(
(XCBaseObject *)iZoneObj,
tmpObjects //
);
}
}
//
count = ArraySize(tmpObjects);
has = IsValidSize(count);
if (has)
{
//
Copy(
tmpObjects,
objects,
false //
);
}
}
//
// Demand Zones ...
has = item.HasDemandZones();
if (has &&
drawDemandZones)
{
//
Clean(tmpObjects);
count = item.CountDemandZones();
for (int i = 0; i < count; i++)
{
//
XCDemandZoneObject *iZoneObj;
has = CreateDemandZone(
item.demandZones[i],
iZoneObj //
);
if (has)
{
//
Add(
(XCBaseObject *)iZoneObj,
tmpObjects //
);
}
}
//
count = ArraySize(tmpObjects);
has = IsValidSize(count);
if (has)
{
//
Copy(
tmpObjects,
objects,
false //
);
}
}
//
// Support Zones ...
has = item.HasSupportZones();
if (has &&
drawSupportZones)
{
//
Clean(tmpObjects);
count = item.CountSupportZones();
for (int i = 0; i < count; i++)
{
//
XCSupportZoneObject *iZoneObj;
has = CreateSupportZone(
item.supportZones[i],
iZoneObj //
);
if (has)
{
//
Add(
(XCBaseObject *)iZoneObj,
tmpObjects //
);
}
}
//
count = ArraySize(tmpObjects);
has = IsValidSize(count);
if (has)
{
//
Copy(
tmpObjects,
objects,
false //
);
}
}
//
// Resistance Zones ...
has = item.HasResistanceZones();
if (has &&
drawResistanceZones)
{
//
Clean(tmpObjects);
count = item.CountResistanceZones();
for (int i = 0; i < count; i++)
{
//
XCResistanceZoneObject *iZoneObj;
has = CreateResistanceZone(
item.resistanceZones[i],
iZoneObj //
);
if (has)
{
//
Add(
(XCBaseObject *)iZoneObj,
tmpObjects //
);
}
}
//
count = ArraySize(tmpObjects);
has = IsValidSize(count);
if (has)
{
//
Copy(
tmpObjects,
objects,
false //
);
}
}
//
Clean(tmpObjects);
//
result = ArraySize(objects);
//
return result;
}
//
protected:
//
+161 -96
View File
@@ -6099,6 +6099,12 @@ struct XOBFVG
//
ZeroMemory(ob);
ZeroMemory(fvg);
//
Clean(supplyZones);
Clean(demandZones);
Clean(supportZones);
Clean(resistanceZones);
}
//
@@ -6181,13 +6187,15 @@ struct XOBFVG
bool has = false;
//
if (HasOB())
has = HasOB();
if (has)
{
ob.To(value);
}
//
if (HasFVG())
has = HasFVG();
if (has)
{
fvg.To(value);
}
@@ -6199,7 +6207,7 @@ struct XOBFVG
{
//
count = CountSupplyZones();
for (int i = 0; count; i++)
for (int i = 0; i < count; i++)
{
supplyZones[i].To(value);
}
@@ -6212,7 +6220,7 @@ struct XOBFVG
{
//
count = CountDemandZones();
for (int i = 0; count; i++)
for (int i = 0; i < count; i++)
{
demandZones[i].To(value);
}
@@ -6225,7 +6233,7 @@ struct XOBFVG
{
//
count = CountSupportZones();
for (int i = 0; count; i++)
for (int i = 0; i < count; i++)
{
supportZones[i].To(value);
}
@@ -6238,7 +6246,7 @@ struct XOBFVG
{
//
count = CountResistanceZones();
for (int i = 0; count; i++)
for (int i = 0; i < count; i++)
{
resistanceZones[i].To(value);
}
@@ -8365,6 +8373,7 @@ int GetLowest(
* @param applyFromFilter: Filter Sorted Zones based on Occured Date ...
* @param applyPlaceFilter: Filter Sorted Zones based on Occured Place ...
* @param ignoreInside: Ignore Inside Sides of POI(s) Zones in Related to Order Block ...
* @param applyFromFilterForPOIs: Apply From Filter for Other POI(s) ...
*
* @return ( int )
*/
@@ -8397,7 +8406,11 @@ int ExtractOBFVGZones(
bool applyFromFilter = true,
bool applyPlaceFilter = true,
//
bool ignoreInside = true
bool ignoreInside = true,
//
bool detectInsideOBPOIs = true,
bool detectInsideFVGPOIs = true,
bool applyFromFilterForPOIs = true
//
)
{
@@ -9008,7 +9021,11 @@ int ExtractOBFVGZones(
//
// Detecting Other POI(s) ...
has = HasChild(dest);
if (has)
bool canDetectPOIs =
detectInsideOBPOIs ||
detectInsideFVGPOIs;
if (has &&
canDetectPOIs)
{
//
count = ArraySize(dest);
@@ -9024,27 +9041,15 @@ int ExtractOBFVGZones(
{
//
bool isInsideOB = IsInsideDiff(
stfState.supplyZones[j],
dest[i].ob,
false //
) ||
IsInsideDiff(
stfState.supplyZones[j],
dest[i].ob,
true //
);
stfState.supplyZones[j],
dest[i].ob //
);
//
bool isInsideFVG = IsInsideDiff(
stfState.supplyZones[j],
dest[i].fvg,
false //
) ||
IsInsideDiff(
stfState.supplyZones[j],
dest[i].fvg,
true //
);
stfState.supplyZones[j],
dest[i].fvg //
);
//
bool isInside = isInsideOB ||
@@ -9052,10 +9057,34 @@ int ExtractOBFVGZones(
if (isInside)
{
//
Add(
stfState.supplyZones[j],
dest[i].supplyZones //
);
bool isPassed =
detectInsideOBPOIs
? isInsideOB
: detectInsideFVGPOIs
? isInsideFVG
: false;
if (isPassed)
{
//
isPassed =
!applyFromFilterForPOIs
? isPassed
: isInsideOB
? stfState.supplyZones[j].From() > dest[i].ob.From()
: isInsideFVG
? stfState.supplyZones[j].From() > dest[i].fvg.From()
: false;
}
//
if (isPassed)
{
//
Add(
stfState.supplyZones[j],
dest[i].supplyZones //
);
}
}
}
}
@@ -9070,27 +9099,15 @@ int ExtractOBFVGZones(
{
//
bool isInsideOB = IsInsideDiff(
stfState.demandZones[j],
dest[i].ob,
false //
) ||
IsInsideDiff(
stfState.demandZones[j],
dest[i].ob,
true //
);
stfState.demandZones[j],
dest[i].ob //
);
//
bool isInsideFVG = IsInsideDiff(
stfState.demandZones[j],
dest[i].fvg,
false //
) ||
IsInsideDiff(
stfState.demandZones[j],
dest[i].fvg,
true //
);
stfState.demandZones[j],
dest[i].fvg //
);
//
bool isInside = isInsideOB ||
@@ -9098,10 +9115,34 @@ int ExtractOBFVGZones(
if (isInside)
{
//
Add(
stfState.demandZones[j],
dest[i].demandZones //
);
bool isPassed =
detectInsideOBPOIs
? isInsideOB
: detectInsideFVGPOIs
? isInsideFVG
: false;
if (isPassed)
{
//
isPassed =
!applyFromFilterForPOIs
? isPassed
: isInsideOB
? stfState.demandZones[j].From() > dest[i].ob.From()
: isInsideFVG
? stfState.demandZones[j].From() > dest[i].fvg.From()
: false;
}
//
if (isPassed)
{
//
Add(
stfState.demandZones[j],
dest[i].demandZones //
);
}
}
}
}
@@ -9116,27 +9157,15 @@ int ExtractOBFVGZones(
{
//
bool isInsideOB = IsInsideDiff(
stfState.supportZones[j],
dest[i].ob,
false //
) ||
IsInsideDiff(
stfState.supportZones[j],
dest[i].ob,
true //
);
stfState.supportZones[j],
dest[i].ob //
);
//
bool isInsideFVG = IsInsideDiff(
stfState.supportZones[j],
dest[i].fvg,
false //
) ||
IsInsideDiff(
stfState.supportZones[j],
dest[i].fvg,
true //
);
stfState.supportZones[j],
dest[i].fvg //
);
//
bool isInside = isInsideOB ||
@@ -9144,10 +9173,34 @@ int ExtractOBFVGZones(
if (isInside)
{
//
Add(
stfState.supportZones[j],
dest[i].supportZones //
);
bool isPassed =
detectInsideOBPOIs
? isInsideOB
: detectInsideFVGPOIs
? isInsideFVG
: false;
if (isPassed)
{
//
isPassed =
!applyFromFilterForPOIs
? isPassed
: isInsideOB
? stfState.supportZones[j].From() > dest[i].ob.From()
: isInsideFVG
? stfState.supportZones[j].From() > dest[i].fvg.From()
: false;
}
//
if (isPassed)
{
//
Add(
stfState.supportZones[j],
dest[i].supportZones //
);
}
}
}
}
@@ -9162,27 +9215,15 @@ int ExtractOBFVGZones(
{
//
bool isInsideOB = IsInsideDiff(
stfState.resistanceZones[j],
dest[i].ob,
false //
) ||
IsInsideDiff(
stfState.resistanceZones[j],
dest[i].ob,
true //
);
stfState.resistanceZones[j],
dest[i].ob //
);
//
bool isInsideFVG = IsInsideDiff(
stfState.resistanceZones[j],
dest[i].fvg,
false //
) ||
IsInsideDiff(
stfState.resistanceZones[j],
dest[i].fvg,
true //
);
stfState.resistanceZones[j],
dest[i].fvg //
);
//
bool isInside = isInsideOB ||
@@ -9190,10 +9231,34 @@ int ExtractOBFVGZones(
if (isInside)
{
//
Add(
stfState.resistanceZones[j],
dest[i].resistanceZones //
);
bool isPassed =
detectInsideOBPOIs
? isInsideOB
: detectInsideFVGPOIs
? isInsideFVG
: false;
if (isPassed)
{
//
isPassed =
!applyFromFilterForPOIs
? isPassed
: isInsideOB
? stfState.resistanceZones[j].From() > dest[i].ob.From()
: isInsideFVG
? stfState.resistanceZones[j].From() > dest[i].fvg.From()
: false;
}
//
if (isPassed)
{
//
Add(
stfState.resistanceZones[j],
dest[i].resistanceZones //
);
}
}
}
}
@@ -236,6 +236,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
X_DIRECTION_BULLISH,
consolidationState,
analyseState,
decisionState,
zIndex,
period,
visionCycleHelper.mPOIDrawer //
@@ -246,6 +247,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
X_DIRECTION_BEARISH,
consolidationState,
analyseState,
decisionState,
zIndex,
period,
visionCycleHelper.mPOIDrawer //
+148 -11
View File
@@ -553,6 +553,7 @@ struct X121SMCStrategyXWZSignalConditions
ENUM_X_DIRECTION forDir,
XPOIState &htfState,
XPOIState &mtfState,
XPOIState &stfState,
int barIndex = 0,
ENUM_TIMEFRAMES forPeriod = NULL,
XCPOIDrawer *drawer = NULL //
@@ -568,6 +569,7 @@ struct X121SMCStrategyXWZSignalConditions
IsValid(period) &&
htfState.HasChild() &&
mtfState.HasChild() &&
stfState.HasChild() &&
HasDirection(forDir)
//
;
@@ -595,7 +597,7 @@ struct X121SMCStrategyXWZSignalConditions
count = ExtractOBFVGZones(
htfState,
mtfState,
mtfState,
stfState,
tmpOBFVGs,
forDir,
NULL, // For Period ...
@@ -620,7 +622,11 @@ struct X121SMCStrategyXWZSignalConditions
true, // From Filter ...
true, // Place Filter ...
//
true // Ignore Inside in Place Filter ...
true, // Ignore Inside in Place Filter ...
//
true, // Detect Inside OB POI(s) ...
false, // Detect Inside FVG POI(s) ...
true // Apply From Filter to Selected POI(s) ...
);
has = IsValidSize(count);
if (has)
@@ -630,20 +636,151 @@ struct X121SMCStrategyXWZSignalConditions
{
//
XOBFVG iOBFVG = tmpOBFVGs[i];
iOBFVG.UpdateTo(NULL);
// //
// if (iOBFVG.HasOB())
// {
// //
// XCBaseObject *iObj;
// drawer.CreateOrderBlock(
// iOBFVG.ob,
// iObj //
// );
// //
// if (stfState.HasSupplyZones())
// {
// //
// for (int j = 0; j < stfState.CountSupplyZones(); j++)
// {
// //
// XCSupplyZone *jZone = stfState.supplyZones[j];
// //
// bool isInside = IsInsideDiff(
// jZone,
// iOBFVG.ob,
// false //
// );
// //
// if (isInside)
// {
// //
// XCSupplyZoneObject *iObj;
// drawer.CreateSupplyZone(
// jZone,
// iObj //
// );
// }
// }
// }
// //
// if (stfState.HasDemandZones())
// {
// //
// for (int j = 0; j < stfState.CountDemandZones(); j++)
// {
// //
// XCDemandZone *jZone = stfState.demandZones[j];
// //
// bool isInside = IsInsideDiff(
// jZone,
// iOBFVG.ob,
// false //
// );
// //
// if (isInside)
// {
// //
// XCDemandZoneObject *iObj;
// drawer.CreateDemandZone(
// jZone,
// iObj //
// );
// }
// }
// }
// //
// if (stfState.HasSupportZones())
// {
// //
// for (int j = 0; j < stfState.CountSupportZones(); j++)
// {
// //
// XCSupportZone *jZone = stfState.supportZones[j];
// //
// bool isInside = IsInsideDiff(
// jZone,
// iOBFVG.ob,
// false //
// );
// //
// if (isInside)
// {
// //
// XCSupportZoneObject *iObj;
// drawer.CreateSupportZone(
// jZone,
// iObj //
// );
// }
// }
// }
// //
// if (stfState.HasResistanceZones())
// {
// //
// for (int j = 0; j < stfState.CountResistanceZones(); j++)
// {
// //
// XCResistanceZone *jZone = stfState.resistanceZones[j];
// //
// bool isInside = IsInsideDiff(
// jZone,
// iOBFVG.ob,
// false //
// );
// //
// if (isInside)
// {
// //
// XCResistanceZoneObject *iObj;
// drawer.CreateResistanceZone(
// jZone,
// iObj //
// );
// }
// }
// }
// }
//
XCBaseObject *iOBObjs[];
int drawnCount = drawer.DrawOrderBlock(
iOBFVG.ob,
iOBObjs //
XCBaseObject *drawnObjects[];
int drawnObjectsCount = drawer.DrawOBFVG(
iOBFVG,
drawnObjects,
//
true, // Draw Order Block ...
true, // Draw Fair Value Gap ...
true, // Draw Supply Zones ...
true, // Draw Demand Zones ...
true, // Draw Support Zones ...
true // Draw Resistance Zones ...
);
//
XCBaseObject *iFVGObjs[];
drawnCount = drawer.DrawFairValueGap(
iOBFVG.fvg,
iFVGObjs //
);
iOBFVG.Clean();
}
}