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;
}
//
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(
tmpTicks,
0,
1);
1 //
);
//
XBoxZone iBox;
bool isBoxBreaked = false;
has = iPVTick.GetMaxVolumeBox(iBox);
if (has)
{
//
isBoxBreaked = IsBoxBreaked(
iBox,
unAvailableBoxes,
barIndex //
);
}
//
has = IsPivotBreaked(
@@ -5836,7 +5925,7 @@ class XCXCAEAPOIDetector : public XCBase
unAvailableBoxes,
barIndex //
);
if (!has)
if (!has && !isBoxBreaked)
{
//
AddRef(
@@ -5865,7 +5954,22 @@ class XCXCAEAPOIDetector : public XCBase
ArrayRemove(
tmpTicks,
0,
1);
1 //
);
//
XBoxZone iBox;
bool isBoxBreaked = false;
has = iPVTick.GetMaxVolumeBox(iBox);
if (has)
{
//
isBoxBreaked = IsBoxBreaked(
iBox,
unAvailableBoxes,
barIndex //
);
}
//
has = IsPivotBreaked(
@@ -5873,7 +5977,7 @@ class XCXCAEAPOIDetector : public XCBase
unAvailableBoxes,
barIndex //
);
if (!has)
if (!has && !isBoxBreaked)
{
//
AddRef(
@@ -7450,6 +7554,137 @@ class XCXCAEAPOIDetector : public XCBase
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 sameHHPivotColor;
color sameLLPivotColor;
color ticksBullishColor;
color ticksBearishColor;
color kiBullishPivotColor;
color kiBearishPivotColor;
color fvgBullishPivotColor;
@@ -96,6 +98,8 @@ class XCXCAEAPOIDrawer : public XCBase
int valePivotWidth;
int sameHHPivotWidth;
int sameLLPivotWidth;
int ticksBullishWidth;
int ticksBearishWidth;
int kiBullishPivotWidth;
int kiBearishPivotWidth;
int fvgBullishPivotWidth;
@@ -115,6 +119,8 @@ class XCXCAEAPOIDrawer : public XCBase
ENUM_LINE_STYLE valePivotStyle;
ENUM_LINE_STYLE sameHHPivotStyle;
ENUM_LINE_STYLE sameLLPivotStyle;
ENUM_LINE_STYLE ticksBullishStyle;
ENUM_LINE_STYLE ticksBearishStyle;
ENUM_LINE_STYLE kiBullishPivotStyle;
ENUM_LINE_STYLE kiBearishPivotStyle;
ENUM_LINE_STYLE fvgBullishPivotStyle;
@@ -125,7 +131,6 @@ class XCXCAEAPOIDrawer : public XCBase
ENUM_LINE_STYLE oscsBearishPivotStyle;
ENUM_LINE_STYLE trendBullishPivotStyle;
ENUM_LINE_STYLE trendBearishPivotStyle;
//
// Constructors ...
XCXCAEAPOIDrawer(
@@ -229,6 +234,8 @@ class XCXCAEAPOIDrawer : public XCBase
valePivotColor = defBullishPivotColor;
sameHHPivotColor = defBearishPivotColor;
sameLLPivotColor = defBullishPivotColor;
ticksBullishColor = defBearishPivotColor;
ticksBearishColor = defBullishPivotColor;
kiBullishPivotColor = defBullishPivotColor;
kiBearishPivotColor = defBearishPivotColor;
fvgBullishPivotColor = defBullishPivotColor;
@@ -248,6 +255,8 @@ class XCXCAEAPOIDrawer : public XCBase
valePivotWidth = defBullishPivotWidth;
sameHHPivotWidth = defBearishPivotWidth;
sameLLPivotWidth = defBullishPivotWidth;
ticksBullishWidth = defBearishPivotWidth;
ticksBearishWidth = defBullishPivotWidth;
kiBullishPivotWidth = defBullishPivotWidth;
kiBearishPivotWidth = defBearishPivotWidth;
fvgBullishPivotWidth = defBullishPivotWidth;
@@ -267,6 +276,8 @@ class XCXCAEAPOIDrawer : public XCBase
valePivotStyle = defBullishPivotStyle;
sameHHPivotStyle = defBearishPivotStyle;
sameLLPivotStyle = defBullishPivotStyle;
ticksBullishStyle = defBearishPivotStyle;
ticksBearishStyle = defBullishPivotStyle;
kiBullishPivotStyle = defBullishPivotStyle;
kiBearishPivotStyle = defBearishPivotStyle;
fvgBullishPivotStyle = defBullishPivotStyle;
@@ -281,7 +292,7 @@ class XCXCAEAPOIDrawer : public XCBase
void Draw(datetime to = NULL)
{
//
DrawTicks();
DrawTicks(to);
DrawSWHPivots(to);
DrawSWLPivots(to);
DrawPeakPivots(to);
@@ -315,7 +326,7 @@ class XCXCAEAPOIDrawer : public XCBase
//
//
void DrawTicks()
void DrawTicks(datetime to = NULL)
{
//
if (!drawTicks)
@@ -323,41 +334,114 @@ class XCXCAEAPOIDrawer : public XCBase
return;
}
//
bool canUpdateTo = IsValid(to);
//
// PEAK TICKS ...
bool has = detector.HasPeakTicks();
if (has) {
if (has)
{
//
int count = detector.CountPeakTicks();
for (int i = 0; i < count; i++) {
for (int i = 0; i < count; i++)
{
//
XCTicksZoneObject *iObj;
has = drawer.CreateTicksZone(
detector.peakTicks[i].zone,
XCAPVTick iPVTick = detector.peakTicks[i];
//
// 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 //
);
if (has) {
mPeakPivotObjects.Add(iObj);
if (has)
{
//
iObj.BoxColor(ticksBearishColor);
iObj.BoxWidth(ticksBearishWidth);
iObj.BoxStyle(ticksBearishStyle);
//
mPeakSWHResPivotObjects.Add(iObj);
}
//
iBox.Clean();
iPVTick.Clean();
ZeroMemory(iObj);
}
}
//
// VALE TICKS ...
has = detector.HasValeTicks();
if (has) {
if (has)
{
//
int count = detector.CountValeTicks();
for (int i = 0; i < count; i++) {
for (int i = 0; i < count; i++)
{
//
XCTicksZoneObject *iObj;
has = drawer.CreateTicksZone(
detector.valeTicks[i].zone,
XCAPVTick iPVTick = detector.valeTicks[i];
//
// 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 //
);
if (has) {
mPeakPivotObjects.Add(iObj);
if (has)
{
//
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.drawTKIBearishPivots = false;
drawer.drawPVFVGBullishPivots = true;
drawer.drawPVFVGBearishPivots = true;
drawer.drawPVFVGBearishPivots = true;
drawer.drawCycleSameLLPivots = false;
drawer.drawCycleSameHHPivots = false;
drawer.drawTrendBullishPivots = false;
@@ -804,28 +804,34 @@ class XCXCAEASignaller : XCBase
// Configure Width ...
drawer.peakPivotWidth = 1;
drawer.valePivotWidth = 1;
drawer.ticksBullishWidth = 2;
drawer.ticksBearishWidth = 2;
drawer.fvgBullishPivotWidth = 1;
drawer.fvgBearishPivotWidth = 1;
drawer.oscsBullishPivotWidth = 2;
drawer.oscsBearishPivotWidth = 2;
drawer.oscsBearishPivotWidth = 2;
//
// Configure Colors ...
drawer.peakPivotColor = clrMagenta;
drawer.valePivotColor = clrAqua;
drawer.ticksBullishColor = clrYellow;
drawer.ticksBearishColor = clrOrange;
drawer.fvgBullishPivotColor = clrLime;
drawer.fvgBearishPivotColor = clrRed;
drawer.oscsBullishPivotColor = clrYellow;
drawer.oscsBearishPivotColor = clrOrange;
drawer.oscsBearishPivotColor = clrOrange;
//
// Configure Style ...
drawer.peakPivotStyle = STYLE_SOLID;
drawer.valePivotStyle = STYLE_SOLID;
drawer.ticksBullishStyle = STYLE_DOT;
drawer.ticksBearishStyle = STYLE_DOT;
drawer.fvgBullishPivotStyle = STYLE_DASH;
drawer.fvgBearishPivotStyle = STYLE_DASH;
drawer.oscsBullishPivotStyle = STYLE_SOLID;
drawer.oscsBearishPivotStyle = STYLE_SOLID;
drawer.oscsBearishPivotStyle = STYLE_SOLID;
}
/**