This commit is contained in:
2025-04-22 19:56:02 +03:30
parent 168f2c58d1
commit 9d36b16ee4
3 changed files with 350 additions and 25 deletions
+239 -4
View File
@@ -734,6 +734,80 @@ struct XCAPVTick
return result; return result;
} }
//
bool GetMaxVolumeBox(XBoxZone &box)
{
//
bool result = false;
//
box.Clean();
//
result = IsValid();
if (!result)
{
return result;
}
//
// Select MAX Volume Zone ...
XCTickZone *selectedZone = NULL;
int zonesCount = zone.Count();
for (int j = 0; j < zonesCount; j++)
{
//
XCTickZone *jZone = zone.GetZone(j);
//
bool canSet =
selectedZone == NULL
? true
: selectedZone.volume < jZone.volume;
if (canSet)
{
selectedZone = jZone;
}
//
ZeroMemory(jZone);
}
//
result = selectedZone != NULL;
if (!result)
{
//
box.Clean();
ZeroMemory(selectedZone);
//
return result;
}
//
result = pivot.AsBox(box);
if (!result)
{
//
box.Clean();
//
return result;
}
box.upper = selectedZone.high;
box.lower = selectedZone.low;
box.type =
pivot.type == XCA_PEAKSWHRES
? "PEAKTICK"
: pivot.type == XCA_VALESWLSUP
? "VALETICK"
: box.type;
//
return result;
}
// //
}; };
@@ -5828,7 +5902,22 @@ class XCXCAEAPOIDetector : public XCBase
ArrayRemove( ArrayRemove(
tmpTicks, tmpTicks,
0, 0,
1); 1 //
);
//
XBoxZone iBox;
bool isBoxBreaked = false;
has = iPVTick.GetMaxVolumeBox(iBox);
if (has)
{
//
isBoxBreaked = IsBoxBreaked(
iBox,
unAvailableBoxes,
barIndex //
);
}
// //
has = IsPivotBreaked( has = IsPivotBreaked(
@@ -5836,7 +5925,7 @@ class XCXCAEAPOIDetector : public XCBase
unAvailableBoxes, unAvailableBoxes,
barIndex // barIndex //
); );
if (!has) if (!has && !isBoxBreaked)
{ {
// //
AddRef( AddRef(
@@ -5865,7 +5954,22 @@ class XCXCAEAPOIDetector : public XCBase
ArrayRemove( ArrayRemove(
tmpTicks, tmpTicks,
0, 0,
1); 1 //
);
//
XBoxZone iBox;
bool isBoxBreaked = false;
has = iPVTick.GetMaxVolumeBox(iBox);
if (has)
{
//
isBoxBreaked = IsBoxBreaked(
iBox,
unAvailableBoxes,
barIndex //
);
}
// //
has = IsPivotBreaked( has = IsPivotBreaked(
@@ -5873,7 +5977,7 @@ class XCXCAEAPOIDetector : public XCBase
unAvailableBoxes, unAvailableBoxes,
barIndex // barIndex //
); );
if (!has) if (!has && !isBoxBreaked)
{ {
// //
AddRef( AddRef(
@@ -7450,6 +7554,137 @@ class XCXCAEAPOIDetector : public XCBase
return result; return result;
} }
//
bool IsBoxBreaked(
XBoxZone &box,
XBoxZone &unAvailableBoxes[],
int barIndex = 0 //
)
{
//
bool result = false;
//
barIndex = NormalizeInt(barIndex, 0);
//
result = box.IsValid();
if (!result)
{
//
// Assume Invalid Boxes as Broken ...
return true;
}
//
int idx = -1;
result = FindBoxIndex(
idx,
box,
unAvailableBoxes //
);
if (result)
{
//
// Assume UnAvailable Boxes as Broken ...
return result;
}
//
int toIDX = box.ToIndex();
result = toIDX > barIndex;
if (!result)
{
return result;
}
//
bool isBullish = box.IsBullish();
double boundary =
isBullish
? box.lower
: box.upper;
//
// for validating Box Break we have to wait At Least 3 Bars Close
// out of Box Boundary ...
int barsLength = 3;
//
int startCheckBreaktionBarIndex = toIDX - barsLength;
result = startCheckBreaktionBarIndex > 0 &&
barIndex < startCheckBreaktionBarIndex;
if (!result)
{
return result;
}
//
XOHCL cBar;
XOHCL pBar;
XOHCL p2Bar;
for (int i = barIndex; i < startCheckBreaktionBarIndex; i++)
{
//
result = cBar.Init(
box.symbol,
box.period,
i + 1 //
);
result =
result &&
cBar.GetPreviousBar(pBar);
result =
result &&
pBar.GetPreviousBar(p2Bar);
if (!result)
{
//
cBar.Clean();
pBar.Clean();
p2Bar.Clean();
//
break;
}
//
bool isBullishBreaked =
isBullish &&
cBar.close < boundary &&
pBar.close < boundary &&
p2Bar.close < boundary;
//
bool isBearishBreaked =
!isBullish &&
cBar.close > boundary &&
pBar.close > boundary &&
p2Bar.close > boundary;
//
result = isBullishBreaked ||
isBearishBreaked;
if (result)
{
break;
}
//
cBar.Clean();
pBar.Clean();
p2Bar.Clean();
}
//
cBar.Clean();
pBar.Clean();
p2Bar.Clean();
//
return result;
}
// //
}; };
+101 -17
View File
@@ -77,6 +77,8 @@ class XCXCAEAPOIDrawer : public XCBase
color valePivotColor; color valePivotColor;
color sameHHPivotColor; color sameHHPivotColor;
color sameLLPivotColor; color sameLLPivotColor;
color ticksBullishColor;
color ticksBearishColor;
color kiBullishPivotColor; color kiBullishPivotColor;
color kiBearishPivotColor; color kiBearishPivotColor;
color fvgBullishPivotColor; color fvgBullishPivotColor;
@@ -96,6 +98,8 @@ class XCXCAEAPOIDrawer : public XCBase
int valePivotWidth; int valePivotWidth;
int sameHHPivotWidth; int sameHHPivotWidth;
int sameLLPivotWidth; int sameLLPivotWidth;
int ticksBullishWidth;
int ticksBearishWidth;
int kiBullishPivotWidth; int kiBullishPivotWidth;
int kiBearishPivotWidth; int kiBearishPivotWidth;
int fvgBullishPivotWidth; int fvgBullishPivotWidth;
@@ -115,6 +119,8 @@ class XCXCAEAPOIDrawer : public XCBase
ENUM_LINE_STYLE valePivotStyle; ENUM_LINE_STYLE valePivotStyle;
ENUM_LINE_STYLE sameHHPivotStyle; ENUM_LINE_STYLE sameHHPivotStyle;
ENUM_LINE_STYLE sameLLPivotStyle; ENUM_LINE_STYLE sameLLPivotStyle;
ENUM_LINE_STYLE ticksBullishStyle;
ENUM_LINE_STYLE ticksBearishStyle;
ENUM_LINE_STYLE kiBullishPivotStyle; ENUM_LINE_STYLE kiBullishPivotStyle;
ENUM_LINE_STYLE kiBearishPivotStyle; ENUM_LINE_STYLE kiBearishPivotStyle;
ENUM_LINE_STYLE fvgBullishPivotStyle; ENUM_LINE_STYLE fvgBullishPivotStyle;
@@ -125,7 +131,6 @@ class XCXCAEAPOIDrawer : public XCBase
ENUM_LINE_STYLE oscsBearishPivotStyle; ENUM_LINE_STYLE oscsBearishPivotStyle;
ENUM_LINE_STYLE trendBullishPivotStyle; ENUM_LINE_STYLE trendBullishPivotStyle;
ENUM_LINE_STYLE trendBearishPivotStyle; ENUM_LINE_STYLE trendBearishPivotStyle;
// //
// Constructors ... // Constructors ...
XCXCAEAPOIDrawer( XCXCAEAPOIDrawer(
@@ -229,6 +234,8 @@ class XCXCAEAPOIDrawer : public XCBase
valePivotColor = defBullishPivotColor; valePivotColor = defBullishPivotColor;
sameHHPivotColor = defBearishPivotColor; sameHHPivotColor = defBearishPivotColor;
sameLLPivotColor = defBullishPivotColor; sameLLPivotColor = defBullishPivotColor;
ticksBullishColor = defBearishPivotColor;
ticksBearishColor = defBullishPivotColor;
kiBullishPivotColor = defBullishPivotColor; kiBullishPivotColor = defBullishPivotColor;
kiBearishPivotColor = defBearishPivotColor; kiBearishPivotColor = defBearishPivotColor;
fvgBullishPivotColor = defBullishPivotColor; fvgBullishPivotColor = defBullishPivotColor;
@@ -248,6 +255,8 @@ class XCXCAEAPOIDrawer : public XCBase
valePivotWidth = defBullishPivotWidth; valePivotWidth = defBullishPivotWidth;
sameHHPivotWidth = defBearishPivotWidth; sameHHPivotWidth = defBearishPivotWidth;
sameLLPivotWidth = defBullishPivotWidth; sameLLPivotWidth = defBullishPivotWidth;
ticksBullishWidth = defBearishPivotWidth;
ticksBearishWidth = defBullishPivotWidth;
kiBullishPivotWidth = defBullishPivotWidth; kiBullishPivotWidth = defBullishPivotWidth;
kiBearishPivotWidth = defBearishPivotWidth; kiBearishPivotWidth = defBearishPivotWidth;
fvgBullishPivotWidth = defBullishPivotWidth; fvgBullishPivotWidth = defBullishPivotWidth;
@@ -267,6 +276,8 @@ class XCXCAEAPOIDrawer : public XCBase
valePivotStyle = defBullishPivotStyle; valePivotStyle = defBullishPivotStyle;
sameHHPivotStyle = defBearishPivotStyle; sameHHPivotStyle = defBearishPivotStyle;
sameLLPivotStyle = defBullishPivotStyle; sameLLPivotStyle = defBullishPivotStyle;
ticksBullishStyle = defBearishPivotStyle;
ticksBearishStyle = defBullishPivotStyle;
kiBullishPivotStyle = defBullishPivotStyle; kiBullishPivotStyle = defBullishPivotStyle;
kiBearishPivotStyle = defBearishPivotStyle; kiBearishPivotStyle = defBearishPivotStyle;
fvgBullishPivotStyle = defBullishPivotStyle; fvgBullishPivotStyle = defBullishPivotStyle;
@@ -281,7 +292,7 @@ class XCXCAEAPOIDrawer : public XCBase
void Draw(datetime to = NULL) void Draw(datetime to = NULL)
{ {
// //
DrawTicks(); DrawTicks(to);
DrawSWHPivots(to); DrawSWHPivots(to);
DrawSWLPivots(to); DrawSWLPivots(to);
DrawPeakPivots(to); DrawPeakPivots(to);
@@ -315,7 +326,7 @@ class XCXCAEAPOIDrawer : public XCBase
// //
// //
void DrawTicks() void DrawTicks(datetime to = NULL)
{ {
// //
if (!drawTicks) if (!drawTicks)
@@ -323,41 +334,114 @@ class XCXCAEAPOIDrawer : public XCBase
return; return;
} }
//
bool canUpdateTo = IsValid(to);
// //
// PEAK TICKS ... // PEAK TICKS ...
bool has = detector.HasPeakTicks(); bool has = detector.HasPeakTicks();
if (has) { if (has)
{
// //
int count = detector.CountPeakTicks(); int count = detector.CountPeakTicks();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++)
{
// //
XCTicksZoneObject *iObj; XCAPVTick iPVTick = detector.peakTicks[i];
has = drawer.CreateTicksZone(
detector.peakTicks[i].zone, //
// Converts Zone to Box ...
XBoxZone iBox;
has = iPVTick.GetMaxVolumeBox(iBox);
if (!has)
{
//
iBox.Clean();
iPVTick.Clean();
//
continue;
}
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj // iObj //
); );
if (has) { if (has)
mPeakPivotObjects.Add(iObj); {
//
iObj.BoxColor(ticksBearishColor);
iObj.BoxWidth(ticksBearishWidth);
iObj.BoxStyle(ticksBearishStyle);
//
mPeakSWHResPivotObjects.Add(iObj);
} }
//
iBox.Clean();
iPVTick.Clean();
ZeroMemory(iObj);
} }
} }
// //
// VALE TICKS ... // VALE TICKS ...
has = detector.HasValeTicks(); has = detector.HasValeTicks();
if (has) { if (has)
{
// //
int count = detector.CountValeTicks(); int count = detector.CountValeTicks();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++)
{
// //
XCTicksZoneObject *iObj; XCAPVTick iPVTick = detector.valeTicks[i];
has = drawer.CreateTicksZone(
detector.valeTicks[i].zone, //
// Converts Zone to Box ...
XBoxZone iBox;
has = iPVTick.GetMaxVolumeBox(iBox);
if (!has)
{
//
iBox.Clean();
iPVTick.Clean();
//
continue;
}
if (canUpdateTo)
{
iBox.to = to;
}
//
XCBoxObject *iObj;
has = drawer.DrawBox(
iBox,
iObj // iObj //
); );
if (has) { if (has)
mPeakPivotObjects.Add(iObj); {
//
iObj.BoxColor(ticksBullishColor);
iObj.BoxWidth(ticksBullishWidth);
iObj.BoxStyle(ticksBullishStyle);
//
mValeSWLSupPivotObjects.Add(iObj);
} }
//
iBox.Clean();
iPVTick.Clean();
ZeroMemory(iObj);
} }
} }
} }
+10 -4
View File
@@ -785,7 +785,7 @@ class XCXCAEASignaller : XCBase
drawer.drawTKIBullishPivots = false; drawer.drawTKIBullishPivots = false;
drawer.drawTKIBearishPivots = false; drawer.drawTKIBearishPivots = false;
drawer.drawPVFVGBullishPivots = true; drawer.drawPVFVGBullishPivots = true;
drawer.drawPVFVGBearishPivots = true; drawer.drawPVFVGBearishPivots = true;
drawer.drawCycleSameLLPivots = false; drawer.drawCycleSameLLPivots = false;
drawer.drawCycleSameHHPivots = false; drawer.drawCycleSameHHPivots = false;
drawer.drawTrendBullishPivots = false; drawer.drawTrendBullishPivots = false;
@@ -804,28 +804,34 @@ class XCXCAEASignaller : XCBase
// Configure Width ... // Configure Width ...
drawer.peakPivotWidth = 1; drawer.peakPivotWidth = 1;
drawer.valePivotWidth = 1; drawer.valePivotWidth = 1;
drawer.ticksBullishWidth = 2;
drawer.ticksBearishWidth = 2;
drawer.fvgBullishPivotWidth = 1; drawer.fvgBullishPivotWidth = 1;
drawer.fvgBearishPivotWidth = 1; drawer.fvgBearishPivotWidth = 1;
drawer.oscsBullishPivotWidth = 2; drawer.oscsBullishPivotWidth = 2;
drawer.oscsBearishPivotWidth = 2; drawer.oscsBearishPivotWidth = 2;
// //
// Configure Colors ... // Configure Colors ...
drawer.peakPivotColor = clrMagenta; drawer.peakPivotColor = clrMagenta;
drawer.valePivotColor = clrAqua; drawer.valePivotColor = clrAqua;
drawer.ticksBullishColor = clrYellow;
drawer.ticksBearishColor = clrOrange;
drawer.fvgBullishPivotColor = clrLime; drawer.fvgBullishPivotColor = clrLime;
drawer.fvgBearishPivotColor = clrRed; drawer.fvgBearishPivotColor = clrRed;
drawer.oscsBullishPivotColor = clrYellow; drawer.oscsBullishPivotColor = clrYellow;
drawer.oscsBearishPivotColor = clrOrange; drawer.oscsBearishPivotColor = clrOrange;
// //
// Configure Style ... // Configure Style ...
drawer.peakPivotStyle = STYLE_SOLID; drawer.peakPivotStyle = STYLE_SOLID;
drawer.valePivotStyle = STYLE_SOLID; drawer.valePivotStyle = STYLE_SOLID;
drawer.ticksBullishStyle = STYLE_DOT;
drawer.ticksBearishStyle = STYLE_DOT;
drawer.fvgBullishPivotStyle = STYLE_DASH; drawer.fvgBullishPivotStyle = STYLE_DASH;
drawer.fvgBearishPivotStyle = STYLE_DASH; drawer.fvgBearishPivotStyle = STYLE_DASH;
drawer.oscsBullishPivotStyle = STYLE_SOLID; drawer.oscsBullishPivotStyle = STYLE_SOLID;
drawer.oscsBearishPivotStyle = STYLE_SOLID; drawer.oscsBearishPivotStyle = STYLE_SOLID;
} }
/** /**