implement trend pivots ...

This commit is contained in:
2025-05-04 00:27:11 +03:30
parent e9a012aa24
commit 637deda2c1
3 changed files with 850 additions and 30 deletions
+224
View File
@@ -88,6 +88,8 @@ class XCXCAEAPOIDrawer : public XCBase
bool drawValePivots;
bool drawFVGBullishPivots;
bool drawFVGBearishPivots;
bool drawTrendBullishPivots;
bool drawTrendBearishPivots;
//
// Styling ...
@@ -104,6 +106,10 @@ class XCXCAEAPOIDrawer : public XCBase
XCAPivotStyle fvgBullishPivotStyle;
XCAPivotStyle fvgBearishPivotStyle;
//
XCAPivotStyle trendBullishPivotStyle;
XCAPivotStyle trendBearishPivotStyle;
//
// Constructors ...
XCXCAEAPOIDrawer(
@@ -141,8 +147,12 @@ class XCXCAEAPOIDrawer : public XCBase
{
//
// Drawing ...
drawPeakPivots = false;
drawValePivots = false;
drawFVGBullishPivots = false;
drawFVGBearishPivots = false;
drawTrendBullishPivots = false;
drawTrendBearishPivots = false;
//
// Styling ...
@@ -171,18 +181,30 @@ class XCXCAEAPOIDrawer : public XCBase
// FVG ...
fvgBullishPivotStyle = defaultBullishStyle;
fvgBearishPivotStyle = defaultBearishStyle;
//
// TREND ...
trendBullishPivotStyle = defaultBullishStyle;
trendBearishPivotStyle = defaultBearishStyle;
}
//
void Draw(datetime to = NULL)
{
//
// PV ...
DrawPeakPivots(to);
DrawValePivots(to);
//
// FVG ...
DrawFVGBullishPivots(to);
DrawFVGBearishPivots(to);
//
// TREND ...
DrawTrendBullishPivots(to);
DrawTrendBearishPivots(to);
}
//
@@ -244,6 +266,24 @@ class XCXCAEAPOIDrawer : public XCBase
to //
);
break;
//
case XCA_TREND_BULL:
//
DrawTrendBullishPivot(
box,
to //
);
break;
//
case XCA_TREND_BEAR:
//
DrawTrendBearishPivot(
box,
to //
);
break;
}
}
@@ -293,6 +333,8 @@ class XCXCAEAPOIDrawer : public XCBase
valePivotStyle.Clean();
fvgBullishPivotStyle.Clean();
fvgBearishPivotStyle.Clean();
trendBullishPivotStyle.Clean();
trendBearishPivotStyle.Clean();
//
// Cleanup Pivot Objects Holder ...
@@ -300,6 +342,8 @@ class XCXCAEAPOIDrawer : public XCBase
mValePivotObjects.Clear();
mFVGBullishPivotObjects.Clear();
mFVGBearishPivotObjects.Clear();
mTrendBullishPivotObjects.Clear();
mTrendBearishPivotObjects.Clear();
}
//
@@ -445,6 +489,76 @@ class XCXCAEAPOIDrawer : public XCBase
}
}
//
void DrawTrendBullishPivots(datetime to = NULL)
{
//
bool has = drawTrendBullishPivots;
if (!has)
{
return;
}
//
has = detector.HasTrendBullishPivots();
if (!has)
{
return;
}
//
int count = detector.CountTrendBullishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.trendBullishPivots[i];
//
DrawTrendBullishPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
void DrawTrendBearishPivots(datetime to = NULL)
{
//
bool has = drawTrendBearishPivots;
if (!has)
{
return;
}
//
has = detector.HasTrendBearishPivots();
if (!has)
{
return;
}
//
int count = detector.CountTrendBearishPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = detector.trendBearishPivots[i];
//
DrawTrendBearishPivot(
iBox,
to //
);
//
iBox.Clean();
}
}
//
// One Item Drawers ...
@@ -660,6 +774,112 @@ class XCXCAEAPOIDrawer : public XCBase
ZeroMemory(iObj);
}
//
void DrawTrendBullishPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawTrendBullishPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_TREND_BULL) &&
item.dir == GetDirection(XCA_TREND_BULL);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
// item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
ApplyPivotStyle(
iObj,
trendBullishPivotStyle //
);
//
// Store Object ...
mTrendBullishPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
void DrawTrendBearishPivot(
XBoxZone &item,
datetime to = NULL //
)
{
//
bool has = drawTrendBearishPivots;
if (!has)
{
return;
}
//
has = item.IsValid() &&
item.type == GetBoxType(XCA_TREND_BEAR) &&
item.dir == GetDirection(XCA_TREND_BEAR);
if (!has)
{
return;
}
//
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
// item.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
item,
iObj //
);
if (has)
{
//
// Style Object ...
ApplyPivotStyle(
iObj,
trendBearishPivotStyle //
);
//
// Store Object ...
mTrendBearishPivotObjects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
// Protected ...
protected:
@@ -702,6 +922,10 @@ class XCXCAEAPOIDrawer : public XCBase
CArrayObj mFVGBullishPivotObjects;
CArrayObj mFVGBearishPivotObjects;
//
CArrayObj mTrendBullishPivotObjects;
CArrayObj mTrendBearishPivotObjects;
//
};