This commit is contained in:
2025-02-11 13:13:49 +03:30
parent ad3a9e691f
commit fe129c3288
4 changed files with 131 additions and 21 deletions
+11
View File
@@ -2902,6 +2902,11 @@ class XCPOIDrawer : public XCBase
long chartID = ChartIdentification(); long chartID = ChartIdentification();
int window = SubWindowIdentification(); int window = SubWindowIdentification();
//
color czColor = IsBullish(zone.breakDir)
? BarBullishColor()
: BarBearishColor();
// //
object = new XCConsolidationZoneObject(); object = new XCConsolidationZoneObject();
result = object.Create( result = object.Create(
@@ -2911,6 +2916,12 @@ class XCPOIDrawer : public XCBase
prefix // prefix //
); );
//
if (result)
{
object.ZoneColor(czColor);
}
// //
return result; return result;
} }
+20 -19
View File
@@ -68,8 +68,9 @@ enum ENUM_XPOIS
X_POI_BEARISH_ORDERBLOCK, // Bearish Order Block ... X_POI_BEARISH_ORDERBLOCK, // Bearish Order Block ...
// //
// Fair Value Gaps ... // Fair Value Gaps ...
X_POI_BULLISH_FVG, // Bullish Order Block ... X_POI_BULLISH_FVG, // Bullish Order Block ...
X_POI_BEARISH_FVG, // Bearish Order Block ... X_POI_BEARISH_FVG, // Bearish Order Block ...
X_POI_CONSOLIDATION_ZONE, // Consolidation Zone ...
}; };
// //
@@ -5557,8 +5558,8 @@ struct XConsolidationZone
int loopback; // Loopback ... int loopback; // Loopback ...
// //
ENUM_X_DIRECTION breakDirection; // Break Direction ... ENUM_X_DIRECTION breakDir; // Break Direction ...
XOHCL breakerBar; // Breaker Bar ... XOHCL breakerBar; // Breaker Bar ...
// //
// Constructor ... // Constructor ...
@@ -5712,11 +5713,11 @@ struct XConsolidationZone
// //
// Calculate Break Direction ... // Calculate Break Direction ...
breakerBar = cBar; breakerBar = cBar;
breakDirection = isBreakTop breakDir = isBreakTop
? X_DIRECTION_BULLISH ? X_DIRECTION_BULLISH
: isBreakBottom : isBreakBottom
? X_DIRECTION_BEARISH ? X_DIRECTION_BEARISH
: X_DIRECTION_NONE; : X_DIRECTION_NONE;
} }
/** /**
@@ -5732,7 +5733,7 @@ struct XConsolidationZone
period = NULL; period = NULL;
initTime = NULL; initTime = NULL;
breakerBar.Clean(); breakerBar.Clean();
breakDirection = X_DIRECTION_NONE; breakDir = X_DIRECTION_NONE;
// //
ZeroMemory(this); ZeroMemory(this);
@@ -5775,7 +5776,7 @@ struct XConsolidationZone
// //
result = breakerBar.IsValid() && result = breakerBar.IsValid() &&
HasDirection(breakDirection); HasDirection(breakDir);
// //
return result; return result;
@@ -5795,7 +5796,7 @@ struct XConsolidationZone
// //
result = IsBreaked() && result = IsBreaked() &&
breakDirection == X_DIRECTION_BEARISH; breakDir == X_DIRECTION_BEARISH;
if (!result) if (!result)
{ {
return result; return result;
@@ -5854,7 +5855,7 @@ struct XConsolidationZone
// //
result = IsBreaked() && result = IsBreaked() &&
breakDirection == X_DIRECTION_BULLISH; breakDir == X_DIRECTION_BULLISH;
if (!result) if (!result)
{ {
return result; return result;
@@ -8665,12 +8666,12 @@ int FilterZones(
bool isPricePassed = bool isPricePassed =
// //
isInside = isInside =
ignoreOutOfBox ignoreOutOfBox
? isInside ? isInside
: isInside && : isInside &&
(isIBullish (isIBullish
? isAbove ? isAbove
: isBelow) : isBelow)
// //
; ;
if (!isPricePassed) if (!isPricePassed)
@@ -430,6 +430,95 @@ class XC121SMCCycleHelper : public XCBase
// //
// Consolidation Zones Implement here ... // Consolidation Zones Implement here ...
//
int czLoopback = 5;
int maxAllowed = 20;
bool isActiveConsolidationZoneBreaked = false;
bool hasActiveConsolidationZone = mActiveConsolidationZone.IsValid();
if (hasActiveConsolidationZone)
{
//
isActiveConsolidationZoneBreaked = mActiveConsolidationZone.IsBreaked();
//
if (isActiveConsolidationZoneBreaked)
{
//
AddRef(
mActiveConsolidationZone,
mConsolidationZones //
);
//
Add(
CONSOLIDATION_BREAKED_DETECTED,
events //
);
//
CleanupArray(
mConsolidationZones,
maxAllowed //
);
// //
// XCConsolidationZoneObject *czObj;
// bool isCreated = mPOIDrawer.CreateConsolidationZone(
// mActiveConsolidationZone,
// czObj //
// );
// if (isCreated)
// {
// mConsolidationObjects.Add(czObj);
// }
//
mActiveConsolidationZone.Clean();
}
else
{
mActiveConsolidationZone.Update();
}
}
else
{
//
XOHCL mBar;
bool hasBar = GetBar(
mBar,
0 //
);
if (hasBar)
{
//
double upper = 0;
double lower = 0;
bool hasConsolidationZone =
mBarAnalyser.IsConsolidate(
mBar,
upper,
lower,
czLoopback //
);
//
if (hasConsolidationZone)
{
//
mActiveConsolidationZone.Init(
GetSymbol(),
GetPeriod(),
upper,
lower,
loopback //
);
}
}
//
mBar.Clean();
}
// //
result = conditions.IsValid(); result = conditions.IsValid();
@@ -461,6 +550,11 @@ class XC121SMCCycleHelper : public XCBase
string mSymbol; string mSymbol;
ENUM_TIMEFRAMES mPeriod; ENUM_TIMEFRAMES mPeriod;
//
CArrayObj mConsolidationObjects;
XConsolidationZone mActiveConsolidationZone;
XConsolidationZone mConsolidationZones[];
// //
// Actions ... // Actions ...
@@ -478,6 +572,10 @@ class XC121SMCCycleHelper : public XCBase
delete mX121Helper; delete mX121Helper;
delete mPOIDetector; delete mPOIDetector;
delete mBarAnalyser; delete mBarAnalyser;
//
Clean(mConsolidationZones);
mActiveConsolidationZone.Clean();
} }
/** /**
+2 -2
View File
@@ -400,10 +400,10 @@ bool DetectX121SMCGuards(
isConsolidationZoneBreaked = x121SMCConsolidationZone.IsBreaked(); isConsolidationZoneBreaked = x121SMCConsolidationZone.IsBreaked();
isConsolidationZoneBreakedUp = isConsolidationZoneBreakedUp =
isConsolidationZoneBreaked && isConsolidationZoneBreaked &&
IsBullish(x121SMCConsolidationZone.breakDirection); IsBullish(x121SMCConsolidationZone.breakDir);
isConsolidationZoneBreakedDown = isConsolidationZoneBreakedDown =
isConsolidationZoneBreaked && isConsolidationZoneBreaked &&
IsBearish(x121SMCConsolidationZone.breakDirection); IsBearish(x121SMCConsolidationZone.breakDir);
// //
// consolidationZoneUpper = triggerXConditions.peaksBuffer[1]; // consolidationZoneUpper = triggerXConditions.peaksBuffer[1];