This commit is contained in:
2025-04-18 09:26:32 +03:30
parent 04535223ea
commit 3c34e0cb66
2 changed files with 623 additions and 279 deletions
+523 -261
View File
@@ -613,20 +613,134 @@ class XCXCAEAPOIDetector : public XCBase
continue; continue;
} }
//
// Provide Some Conditions ...
//
double points = GetPoints(zBar.symbol);
//
// PEAK ...
//
double cPeak = iConditions.peakBuffer[cIDX];
double pPeak = iConditions.peakBuffer[pIDX];
double p2Peak = iConditions.peakBuffer[p2IDX];
//
bool isPeakStartSameLast =
cPeak == pPeak &&
pPeak != p2Peak;
//
bool isPeakFinishedSameLast =
cPeak != pPeak &&
pPeak == p2Peak;
//
// VALE ...
//
double cVale = iConditions.valeBuffer[cIDX];
double pVale = iConditions.valeBuffer[pIDX];
double p2Vale = iConditions.valeBuffer[p2IDX];
//
bool isValeStartSameLast =
cVale == pVale &&
pVale != p2Vale;
//
bool isValeFinishedSameLast =
cVale != pVale &&
pVale == p2Vale;
//
// SWH ...
//
double cSWH = iConditions.swingHighBuffer[cIDX];
double pSWH = iConditions.swingHighBuffer[pIDX];
double p2SWH = iConditions.swingHighBuffer[p2IDX];
//
bool isSWHStartSameLast =
cSWH == pSWH &&
pSWH != p2SWH;
//
bool isSWHFinishedSameLast =
cSWH != pSWH &&
pSWH == p2SWH;
//
// SWL ...
//
double pSWL = iConditions.swingLowBuffer[pIDX];
double cSWL = iConditions.swingLowBuffer[cIDX];
double p2SWL = iConditions.swingLowBuffer[p2IDX];
//
bool isSWLStartSameLast =
cSWL == pSWL &&
pSWL != p2SWL;
//
bool isSWLFinishedSameLast =
cSWL != pSWL &&
pSWL == p2SWL;
//
// SUPPORT ...
//
double cSupport = iConditions.supportBuffer[cIDX];
double pSupport = iConditions.supportBuffer[pIDX];
double p2Support = iConditions.supportBuffer[p2IDX];
//
bool isSupportStartSameLast =
cSupport == pSupport &&
pSupport != p2Support;
//
bool isSupportFinishedSameLast =
cSupport != pSupport &&
pSupport == p2Support;
//
// RESISTANCE ...
//
double pResistance = iConditions.resistanceBuffer[pIDX];
double cResistance = iConditions.resistanceBuffer[cIDX];
double p2Resistance = iConditions.resistanceBuffer[p2IDX];
//
bool isResistanceStartSameLast =
cResistance == pResistance &&
pResistance != p2Resistance;
//
bool isResistanceFinishedSameLast =
cResistance != pResistance &&
pResistance == p2Resistance;
// //
// Checking Pivots ... // Checking Pivots ...
// //
bool detectSWHPivot = false; bool detectSWHPivot = true;
bool detectSWLPivot = false; bool detectSWLPivot = true;
bool detectPeakPivot = false; bool detectPeakPivot = true;
bool detectValePivot = false; bool detectValePivot = true;
bool detectKIBullishPivot = false; bool detectKIBullishPivot = true;
bool detectKIBearishPivot = false; bool detectKIBearishPivot = true;
bool detectTKIBullishPivot = false; bool detectTKIBullishPivot = true;
bool detectTKIBearishPivot = false; bool detectTKIBearishPivot = true;
bool detectPeakSWHResPivot = false; bool detectPeakSWHResPivot = true;
bool detectValeSWLSupPivot = false; bool detectValeSWLSupPivot = true;
bool detectTrendBullishPivot = true; bool detectTrendBullishPivot = true;
bool detectTrendBearishPivot = true; bool detectTrendBearishPivot = true;
@@ -643,12 +757,21 @@ class XCXCAEAPOIDetector : public XCBase
peakPivot.period = iConditions.period; peakPivot.period = iConditions.period;
// //
if (iConditions.isPeakSameLast) if (isPeakFinishedSameLast)
{ {
// //
peakPivot.to = cBar.time; peakPivot.Clean();
//
peakPivot.type = XCA_PEAK;
peakPivot.symbol = iConditions.symbol;
peakPivot.period = iConditions.period;
//
peakPivot.to = pBar.time;
peakPivot.from = pBar.time; peakPivot.from = pBar.time;
peakPivot.value = iConditions.peakBuffer[cIDX]; peakPivot.value = iConditions.peakBuffer[pIDX];
peakPivot.reserve = iConditions.peakGoldenBuffer[pIDX];
} }
} }
@@ -657,6 +780,8 @@ class XCXCAEAPOIDetector : public XCBase
{ {
// //
peakPivot.from = pBar.time; peakPivot.from = pBar.time;
//
peakPivot.reserve = peakPivot.reserve =
peakPivot.reserve == 0 peakPivot.reserve == 0
? iConditions.peakGoldenBuffer[cIDX] ? iConditions.peakGoldenBuffer[cIDX]
@@ -664,7 +789,7 @@ class XCXCAEAPOIDetector : public XCBase
} }
// //
if (!iConditions.isPeakSameLast) if (isPeakStartSameLast)
{ {
// //
has = has =
@@ -684,6 +809,258 @@ class XCXCAEAPOIDetector : public XCBase
} }
} }
//
// Vale Pivot ...
if (detectValePivot)
{
//
if (!valePivot.IsValid())
{
//
valePivot.type = XCA_VALE;
valePivot.symbol = iConditions.symbol;
valePivot.period = iConditions.period;
//
if (isValeFinishedSameLast)
{
//
valePivot.Clean();
//
valePivot.type = XCA_VALE;
valePivot.symbol = iConditions.symbol;
valePivot.period = iConditions.period;
//
valePivot.to = pBar.time;
valePivot.from = pBar.time;
valePivot.value = iConditions.valeBuffer[pIDX];
valePivot.reserve = iConditions.valeGoldenBuffer[pIDX];
}
}
//
if (iConditions.isValeSameLast)
{
//
valePivot.from = pBar.time;
//
valePivot.reserve =
valePivot.reserve == 0
? iConditions.valeGoldenBuffer[cIDX]
: MathMin(valePivot.reserve, iConditions.valeGoldenBuffer[cIDX]);
}
//
if (isValeStartSameLast)
{
//
has = valePivot.IsValid() &&
valePivot.GetAge() >= pivotVerifications;
if (has)
{
//
AddPivot(
valePivot,
valePivots //
);
}
//
valePivot.Clean();
}
}
//
// SWH Pivot ...
if (detectSWHPivot)
{
//
if (!swhPivot.IsValid())
{
//
swhPivot.type = XCA_SWH;
swhPivot.symbol = iConditions.symbol;
swhPivot.period = iConditions.period;
//
if (isSWHFinishedSameLast)
{
//
swhPivot.Clean();
//
swhPivot.type = XCA_SWH;
swhPivot.symbol = iConditions.symbol;
swhPivot.period = iConditions.period;
//
swhPivot.to = pBar.time;
swhPivot.from = pBar.time;
swhPivot.value = iConditions.swingHighBuffer[pIDX];
}
}
//
if (iConditions.isSwingHighSameLast)
{
//
swhPivot.from = pBar.time;
//
double reserve = swhPivot.reserve;
if (pBar.high == pSWH)
{
//
reserve =
reserve == 0
? pBar.GetUp()
: MathMin(reserve, pBar.GetUp());
}
swhPivot.reserve = reserve;
}
//
if (isSWHStartSameLast)
{
//
double reserve = swhPivot.reserve;
if (cBar.high == cSWH)
{
//
reserve =
reserve == 0
? cBar.GetUp()
: MathMin(reserve, cBar.GetUp());
}
if (pBar.high == pSWH)
{
//
reserve =
reserve == 0
? pBar.GetUp()
: MathMin(reserve, pBar.GetUp());
}
if (reserve == 0 || reserve == swhPivot.value)
{
reserve = swhPivot.value - (5 * points);
}
swhPivot.reserve = reserve;
//
has =
swhPivot.IsValid() &&
swhPivot.GetAge() >= pivotVerifications;
if (has)
{
//
AddPivot(
swhPivot,
swhPivots //
);
}
//
swhPivot.Clean();
}
}
//
// SWL Pivot ...
if (detectSWLPivot)
{
//
if (!swlPivot.IsValid())
{
//
swlPivot.type = XCA_SWL;
swlPivot.symbol = iConditions.symbol;
swlPivot.period = iConditions.period;
//
if (isSWLFinishedSameLast)
{
//
swlPivot.Clean();
//
swlPivot.type = XCA_SWL;
swlPivot.symbol = iConditions.symbol;
swlPivot.period = iConditions.period;
//
swlPivot.to = cBar.time;
swlPivot.from = pBar.time;
swlPivot.value = iConditions.swingLowBuffer[cIDX];
}
}
//
if (iConditions.isSwingLowSameLast)
{
//
swlPivot.from = pBar.time;
//
double reserve = swlPivot.reserve;
if (pBar.low == pSWL)
{
//
reserve =
reserve == 0
? pBar.GetDown()
: MathMax(reserve, pBar.GetDown());
}
swlPivot.reserve = reserve;
}
//
if (isSWLStartSameLast)
{
//
double reserve = swlPivot.reserve;
if (cBar.low == cSWL)
{
//
reserve =
reserve == 0
? cBar.GetDown()
: MathMax(reserve, cBar.GetDown());
}
if (pBar.low == pSWL)
{
//
reserve =
reserve == 0
? pBar.GetDown()
: MathMax(reserve, pBar.GetDown());
}
if (reserve == 0 || reserve == swlPivot.value)
{
reserve = swlPivot.value + (5 * points);
}
swlPivot.reserve = reserve;
//
has =
swlPivot.IsValid() &&
swlPivot.GetAge() >= pivotVerifications;
if (has)
{
//
AddPivot(
swlPivot,
swlPivots //
);
}
//
swlPivot.Clean();
}
}
// //
// Peak SWH Res Pivot ... // Peak SWH Res Pivot ...
if (detectPeakSWHResPivot) if (detectPeakSWHResPivot)
@@ -737,59 +1114,6 @@ class XCXCAEAPOIDetector : public XCBase
} }
} }
//
// Vale Pivot ...
if (detectValePivot)
{
//
if (!valePivot.IsValid())
{
//
valePivot.type = XCA_VALE;
valePivot.symbol = iConditions.symbol;
valePivot.period = iConditions.period;
//
if (iConditions.isValeSameLast)
{
//
valePivot.to = cBar.time;
valePivot.from = pBar.time;
valePivot.value = iConditions.valeBuffer[cIDX];
}
}
//
if (iConditions.isValeSameLast)
{
//
valePivot.from = pBar.time;
valePivot.reserve =
valePivot.reserve == 0
? iConditions.valeGoldenBuffer[cIDX]
: MathMin(valePivot.reserve, iConditions.valeGoldenBuffer[cIDX]);
}
//
if (!iConditions.isValeSameLast)
{
//
has = valePivot.IsValid() &&
valePivot.GetAge() >= pivotVerifications;
if (has)
{
//
AddPivot(
valePivot,
valePivots //
);
}
//
valePivot.Clean();
}
}
// //
// Vale SWL Sup Pivot ... // Vale SWL Sup Pivot ...
if (detectValeSWLSupPivot) if (detectValeSWLSupPivot)
@@ -843,114 +1167,6 @@ class XCXCAEAPOIDetector : public XCBase
} }
} }
//
// SWH Pivot ...
if (detectSWHPivot)
{
//
if (!swhPivot.IsValid())
{
//
swhPivot.type = XCA_SWH;
swhPivot.symbol = iConditions.symbol;
swhPivot.period = iConditions.period;
//
if (iConditions.isSwingHighSameLast)
{
//
swhPivot.to = cBar.time;
swhPivot.from = pBar.time;
swhPivot.value = iConditions.swingHighBuffer[cIDX];
}
}
//
if (iConditions.isSwingHighSameLast)
{
swhPivot.from = pBar.time;
}
//
if (!iConditions.isSwingHighSameLast)
{
//
has =
swhPivot.IsValid() &&
cBar.high > cBar.GetUp() &&
cBar.high == swhPivot.value &&
swhPivot.GetAge() >= pivotVerifications;
if (has)
{
//
swhPivot.reserve = cBar.GetUp();
//
AddPivot(
swhPivot,
swhPivots //
);
}
//
swhPivot.Clean();
}
}
//
// SWL Pivot ...
if (detectSWLPivot)
{
//
if (!swlPivot.IsValid())
{
//
swlPivot.type = XCA_SWL;
swlPivot.symbol = iConditions.symbol;
swlPivot.period = iConditions.period;
//
if (iConditions.isSwingLowSameLast)
{
//
swlPivot.to = cBar.time;
swlPivot.from = pBar.time;
swlPivot.value = iConditions.swingLowBuffer[cIDX];
}
}
//
if (iConditions.isSwingLowSameLast)
{
swlPivot.from = pBar.time;
}
//
if (!iConditions.isSwingLowSameLast)
{
//
has =
swlPivot.IsValid() &&
cBar.low < cBar.GetDown() &&
cBar.low == swlPivot.value &&
swlPivot.GetAge() >= pivotVerifications;
if (has)
{
//
swlPivot.reserve = cBar.GetDown();
//
AddPivot(
swlPivot,
swlPivots //
);
}
//
swlPivot.Clean();
}
}
// //
// KI Bullish ... // KI Bullish ...
if (detectKIBullishPivot) if (detectKIBullishPivot)
@@ -964,12 +1180,21 @@ class XCXCAEAPOIDetector : public XCBase
kiBullishPivot.period = iConditions.period; kiBullishPivot.period = iConditions.period;
// //
if (iConditions.isKIBullish) if (iConditions.isKISwitchedToBearish)
{ {
// //
kiBullishPivot.to = cBar.time; kiBullishPivot.Clean();
//
kiBullishPivot.type = XCA_KI_BULL;
kiBullishPivot.symbol = iConditions.symbol;
kiBullishPivot.period = iConditions.period;
//
kiBullishPivot.to = pBar.time;
kiBullishPivot.from = pBar.time; kiBullishPivot.from = pBar.time;
kiBullishPivot.value = iConditions.kiBuffer[cIDX]; kiBullishPivot.value = iConditions.kiBuffer[pIDX];
kiBullishPivot.reserve = iConditions.kiBuffer[pIDX];
} }
} }
@@ -977,11 +1202,21 @@ class XCXCAEAPOIDetector : public XCBase
if (iConditions.isKIBullish) if (iConditions.isKIBullish)
{ {
// //
kiBullishPivot.from = pBar.time; kiBullishPivot.from = cBar.time;
//
Add(
iConditions.kiBuffer[cIDX],
kiBullishPivot.values //
);
//
kiBullishPivot.value = kiBullishPivot.value =
kiBullishPivot.value == 0 kiBullishPivot.value == 0
? iConditions.kiBuffer[cIDX] ? iConditions.kiBuffer[cIDX]
: MathMin(iConditions.kiBuffer[cIDX], kiBullishPivot.value); : MathMin(iConditions.kiBuffer[cIDX], kiBullishPivot.value);
//
kiBullishPivot.reserve = kiBullishPivot.reserve =
kiBullishPivot.reserve == 0 kiBullishPivot.reserve == 0
? iConditions.kiBuffer[cIDX] ? iConditions.kiBuffer[cIDX]
@@ -1022,12 +1257,21 @@ class XCXCAEAPOIDetector : public XCBase
kiBearishPivot.period = iConditions.period; kiBearishPivot.period = iConditions.period;
// //
if (iConditions.isKIBearish) if (iConditions.isKISwitchedToBullish)
{ {
// //
kiBearishPivot.to = cBar.time; kiBearishPivot.Clean();
//
kiBearishPivot.type = XCA_KI_BEAR;
kiBearishPivot.symbol = iConditions.symbol;
kiBearishPivot.period = iConditions.period;
//
kiBearishPivot.to = pBar.time;
kiBearishPivot.from = pBar.time; kiBearishPivot.from = pBar.time;
kiBearishPivot.value = iConditions.kiBuffer[cIDX]; kiBearishPivot.value = iConditions.kiBuffer[pIDX];
kiBearishPivot.reserve = iConditions.kiBuffer[pIDX];
} }
} }
@@ -1035,11 +1279,21 @@ class XCXCAEAPOIDetector : public XCBase
if (iConditions.isKIBearish) if (iConditions.isKIBearish)
{ {
// //
kiBearishPivot.from = pBar.time; kiBearishPivot.from = cBar.time;
//
Add(
iConditions.kiBuffer[cIDX],
kiBearishPivot.values //
);
//
kiBearishPivot.value = kiBearishPivot.value =
kiBearishPivot.value == 0 kiBearishPivot.value == 0
? iConditions.kiBuffer[cIDX] ? iConditions.kiBuffer[cIDX]
: MathMax(iConditions.kiBuffer[cIDX], kiBearishPivot.value); : MathMax(iConditions.kiBuffer[cIDX], kiBearishPivot.value);
//
kiBearishPivot.reserve = kiBearishPivot.reserve =
kiBearishPivot.reserve == 0 kiBearishPivot.reserve == 0
? iConditions.kiBuffer[cIDX] ? iConditions.kiBuffer[cIDX]
@@ -1080,12 +1334,21 @@ class XCXCAEAPOIDetector : public XCBase
tkiBullishPivot.period = iConditions.period; tkiBullishPivot.period = iConditions.period;
// //
if (iConditions.isTKIBullish) if (iConditions.isTKISwitchedToBearish)
{ {
// //
tkiBullishPivot.to = cBar.time; tkiBullishPivot.Clean();
//
tkiBullishPivot.type = XCA_TKI_BULL;
tkiBullishPivot.symbol = iConditions.symbol;
tkiBullishPivot.period = iConditions.period;
//
tkiBullishPivot.to = pBar.time;
tkiBullishPivot.from = pBar.time; tkiBullishPivot.from = pBar.time;
tkiBullishPivot.value = iConditions.tkiBuffer[cIDX]; tkiBullishPivot.value = iConditions.tkiBuffer[pIDX];
tkiBullishPivot.reserve = iConditions.tkiBuffer[pIDX];
} }
} }
@@ -1093,11 +1356,21 @@ class XCXCAEAPOIDetector : public XCBase
if (iConditions.isTKIBullish) if (iConditions.isTKIBullish)
{ {
// //
tkiBullishPivot.from = pBar.time; tkiBullishPivot.from = cBar.time;
//
Add(
iConditions.tkiBuffer[cIDX],
tkiBullishPivot.values //
);
//
tkiBullishPivot.value = tkiBullishPivot.value =
tkiBullishPivot.value == 0 tkiBullishPivot.value == 0
? iConditions.tkiBuffer[cIDX] ? iConditions.tkiBuffer[cIDX]
: MathMin(iConditions.tkiBuffer[cIDX], tkiBullishPivot.value); : MathMin(iConditions.tkiBuffer[cIDX], tkiBullishPivot.value);
//
tkiBullishPivot.reserve = tkiBullishPivot.reserve =
tkiBullishPivot.reserve == 0 tkiBullishPivot.reserve == 0
? iConditions.tkiBuffer[cIDX] ? iConditions.tkiBuffer[cIDX]
@@ -1138,12 +1411,21 @@ class XCXCAEAPOIDetector : public XCBase
tkiBearishPivot.period = iConditions.period; tkiBearishPivot.period = iConditions.period;
// //
if (iConditions.isTKIBearish) if (iConditions.isTKISwitchedToBullish)
{ {
// //
tkiBearishPivot.to = cBar.time; tkiBearishPivot.Clean();
//
tkiBearishPivot.type = XCA_TKI_BEAR;
tkiBearishPivot.symbol = iConditions.symbol;
tkiBearishPivot.period = iConditions.period;
//
tkiBearishPivot.to = pBar.time;
tkiBearishPivot.from = pBar.time; tkiBearishPivot.from = pBar.time;
tkiBearishPivot.value = iConditions.tkiBuffer[cIDX]; tkiBearishPivot.value = iConditions.tkiBuffer[pIDX];
tkiBearishPivot.reserve = iConditions.tkiBuffer[pIDX];
} }
} }
@@ -1151,15 +1433,25 @@ class XCXCAEAPOIDetector : public XCBase
if (iConditions.isTKIBearish) if (iConditions.isTKIBearish)
{ {
// //
tkiBearishPivot.from = pBar.time; tkiBearishPivot.from = cBar.time;
//
Add(
iConditions.tkiBuffer[cIDX],
tkiBearishPivot.values //
);
//
tkiBearishPivot.value = tkiBearishPivot.value =
tkiBearishPivot.value == 0 tkiBearishPivot.value == 0
? iConditions.kiBuffer[cIDX] ? iConditions.tkiBuffer[cIDX]
: MathMax(iConditions.kiBuffer[cIDX], tkiBearishPivot.value); : MathMax(iConditions.tkiBuffer[cIDX], tkiBearishPivot.value);
//
tkiBearishPivot.reserve = tkiBearishPivot.reserve =
tkiBearishPivot.reserve == 0 tkiBearishPivot.reserve == 0
? iConditions.kiBuffer[cIDX] ? iConditions.tkiBuffer[cIDX]
: MathMin(iConditions.kiBuffer[cIDX], tkiBearishPivot.reserve); : MathMin(iConditions.tkiBuffer[cIDX], tkiBearishPivot.reserve);
} }
// //
@@ -1196,33 +1488,43 @@ class XCXCAEAPOIDetector : public XCBase
trendBullishPivot.period = iConditions.period; trendBullishPivot.period = iConditions.period;
// //
if (iConditions.isTrendBullish) if (iConditions.isTrendSwitchedToBearish)
{ {
// //
trendBullishPivot.to = cBar.time; trendBullishPivot.Clean();
//
trendBullishPivot.type = XCA_TREND_BULL;
trendBullishPivot.symbol = iConditions.symbol;
trendBullishPivot.period = iConditions.period;
//
trendBullishPivot.to = pBar.time;
trendBullishPivot.from = pBar.time; trendBullishPivot.from = pBar.time;
trendBullishPivot.value = iConditions.trendBuffer[cIDX]; trendBullishPivot.value = iConditions.trendBuffer[pIDX];
trendBullishPivot.reserve = iConditions.trendBuffer[cIDX]; trendBullishPivot.reserve = iConditions.trendBuffer[pIDX];
} }
} }
// //
if (iConditions.isTrendBullish) if (iConditions.isTrendBullish)
{ {
//
trendBullishPivot.from = cBar.time;
// //
Add( Add(
iConditions.trendBuffer[cIDX], iConditions.trendBuffer[cIDX],
trendBullishPivot.values // trendBullishPivot.values //
); );
//
trendBullishPivot.from = pBar.time;
// //
trendBullishPivot.value = trendBullishPivot.value =
trendBullishPivot.value == 0 trendBullishPivot.value == 0
? iConditions.trendBuffer[cIDX] ? iConditions.trendBuffer[cIDX]
: MathMin(iConditions.trendBuffer[cIDX], trendBullishPivot.value); : MathMin(iConditions.trendBuffer[cIDX], trendBullishPivot.value);
//
trendBullishPivot.reserve = trendBullishPivot.reserve =
trendBullishPivot.reserve == 0 trendBullishPivot.reserve == 0
? iConditions.trendBuffer[cIDX] ? iConditions.trendBuffer[cIDX]
@@ -1238,14 +1540,6 @@ class XCXCAEAPOIDetector : public XCBase
trendBullishPivot.GetAge() >= pivotVerifications; trendBullishPivot.GetAge() >= pivotVerifications;
if (has) if (has)
{ {
// //
// double ivMin = GetMin(trendBullishPivot.values);
// double ivMax = GetMax(trendBullishPivot.values);
// //
// trendBullishPivot.value = ivMin;
// trendBullishPivot.reserve = ivMax;
// //
AddPivot( AddPivot(
trendBullishPivot, trendBullishPivot,
@@ -1271,33 +1565,43 @@ class XCXCAEAPOIDetector : public XCBase
trendBearishPivot.period = iConditions.period; trendBearishPivot.period = iConditions.period;
// //
if (iConditions.isTrendBearish) if (iConditions.isTrendSwitchedToBullish)
{ {
// //
trendBearishPivot.to = cBar.time; trendBearishPivot.Clean();
//
trendBearishPivot.type = XCA_TREND_BEAR;
trendBearishPivot.symbol = iConditions.symbol;
trendBearishPivot.period = iConditions.period;
//
trendBearishPivot.to = pBar.time;
trendBearishPivot.from = pBar.time; trendBearishPivot.from = pBar.time;
trendBearishPivot.value = iConditions.trendBuffer[cIDX]; trendBearishPivot.value = iConditions.trendBuffer[pIDX];
trendBearishPivot.reserve = iConditions.trendBuffer[cIDX]; trendBearishPivot.reserve = iConditions.trendBuffer[pIDX];
} }
} }
// //
if (iConditions.isTrendBearish) if (iConditions.isTrendBearish)
{ {
//
trendBearishPivot.from = cBar.time;
// //
Add( Add(
iConditions.trendBuffer[cIDX], iConditions.trendBuffer[cIDX],
trendBearishPivot.values // trendBearishPivot.values //
); );
//
trendBearishPivot.from = pBar.time;
// //
trendBearishPivot.value = trendBearishPivot.value =
trendBearishPivot.value == 0 trendBearishPivot.value == 0
? iConditions.trendBuffer[cIDX] ? iConditions.trendBuffer[cIDX]
: MathMax(iConditions.trendBuffer[cIDX], trendBearishPivot.value); : MathMax(iConditions.trendBuffer[cIDX], trendBearishPivot.value);
//
trendBearishPivot.reserve = trendBearishPivot.reserve =
trendBearishPivot.reserve == 0 trendBearishPivot.reserve == 0
? iConditions.trendBuffer[cIDX] ? iConditions.trendBuffer[cIDX]
@@ -1313,14 +1617,6 @@ class XCXCAEAPOIDetector : public XCBase
trendBearishPivot.GetAge() >= pivotVerifications; trendBearishPivot.GetAge() >= pivotVerifications;
if (has) if (has)
{ {
// //
// double ivMin = GetMin(trendBearishPivot.values);
// double ivMax = GetMax(trendBearishPivot.values);
// //
// trendBearishPivot.value = ivMax;
// trendBearishPivot.reserve = ivMin;
// //
AddPivot( AddPivot(
trendBearishPivot, trendBearishPivot,
@@ -1354,8 +1650,7 @@ class XCXCAEAPOIDetector : public XCBase
// Peaks ... // Peaks ...
// //
bool bool HasPeakPivots()
HasPeakPivots()
{ {
return HasChild(peakPivots); return HasChild(peakPivots);
} }
@@ -1555,38 +1850,6 @@ class XCXCAEAPOIDetector : public XCBase
XCXCAEAHelper *helper; XCXCAEAHelper *helper;
XCBarAnalyser *barAnalyser; XCBarAnalyser *barAnalyser;
//
void AddBox(
XBoxZone &box,
XBoxZone &boxes[] //
)
{
//
bool has = box.IsValid();
if (!has)
{
return;
}
//
int idx = -1;
has = FindBoxIndex(
idx,
box,
boxes //
);
if (has)
{
return;
}
//
AddRef(
box,
boxes //
);
}
// //
void AddPivot( void AddPivot(
XCAPivot &pivot, XCAPivot &pivot,
@@ -1622,7 +1885,7 @@ class XCXCAEAPOIDetector : public XCBase
// //
has = has =
iPivot.to < pivot.to && iPivot.to > pivot.to &&
iPivot.from == pivot.from && iPivot.from == pivot.from &&
iPivot.value == pivot.value && iPivot.value == pivot.value &&
iPivot.symbol == pivot.symbol && iPivot.symbol == pivot.symbol &&
@@ -1647,7 +1910,6 @@ class XCXCAEAPOIDetector : public XCBase
} }
else else
{ {
//
pivots[updateIDX].to = pivot.to; pivots[updateIDX].to = pivot.to;
} }
+100 -18
View File
@@ -524,38 +524,40 @@ class XCXCAEASignaller : XCBase
datetime cTime = TimeCurrent(); datetime cTime = TimeCurrent();
// //
bool drawSWHPivots = false;
bool drawSWLPivots = false;
bool drawPeakPivots = false; bool drawPeakPivots = false;
bool drawValePivots = false; bool drawValePivots = false;
bool drawSWHPivots = true;
bool drawSWLPivots = true;
bool drawPeakSWHResPivots = false;
bool drawValeSWLSupPivots = false;
bool drawKIBullishPivots = false; bool drawKIBullishPivots = false;
bool drawKIBearishPivots = false; bool drawKIBearishPivots = false;
bool drawTKIBullishPivots = false; bool drawTKIBullishPivots = false;
bool drawTKIBearishPivots = false; bool drawTKIBearishPivots = false;
bool drawTrendBullishPivots = true; bool drawTrendBullishPivots = false;
bool drawTrendBearishPivots = true; bool drawTrendBearishPivots = false;
// //
// Draw Peak SWH Res Pivots ... // Draw Peak Pivots ...
if (drawPeakPivots) if (drawPeakPivots)
{ {
// //
has = detector.HasPeakSWHResPivots(); has = detector.HasPeakPivots();
if (has) if (has)
{ {
// //
count = detector.CountPeakSWHResPivots(); count = detector.CountPeakPivots();
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
// //
XBoxZone iBox; XBoxZone iBox;
has = detector has = detector
.peakSWHResPivots[i] .peakPivots[i]
.AsBox(iBox); .AsBox(iBox);
if (has) if (has)
{ {
// //
iBox.to = cTime; // iBox.to = cTime;
// //
XCBoxObject *iObj; XCBoxObject *iObj;
@@ -576,26 +578,26 @@ class XCXCAEASignaller : XCBase
} }
// //
// Draw Vale SWL Sup Pivots ... // Draw Vale Pivots ...
if (drawValePivots) if (drawValePivots)
{ {
// //
has = detector.HasValeSWLSupPivots(); has = detector.HasValePivots();
if (has) if (has)
{ {
// //
count = detector.CountValeSWLSupPivots(); count = detector.CountValePivots();
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
// //
XBoxZone iBox; XBoxZone iBox;
has = detector has = detector
.valeSWLSupPivots[i] .valePivots[i]
.AsBox(iBox); .AsBox(iBox);
if (has) if (has)
{ {
// //
iBox.to = cTime; // iBox.to = cTime;
// //
XCBoxObject *iObj; XCBoxObject *iObj;
@@ -635,7 +637,7 @@ class XCXCAEASignaller : XCBase
if (has) if (has)
{ {
// //
iBox.to = cTime; // iBox.to = cTime;
// //
XCBoxObject *iObj; XCBoxObject *iObj;
@@ -674,7 +676,7 @@ class XCXCAEASignaller : XCBase
if (has) if (has)
{ {
// //
iBox.to = cTime; // iBox.to = cTime;
// //
XCBoxObject *iObj; XCBoxObject *iObj;
@@ -693,6 +695,86 @@ class XCXCAEASignaller : XCBase
} }
} }
//
// Draw Peak SWH Res Pivots ...
if (drawPeakSWHResPivots)
{
//
has = detector.HasPeakSWHResPivots();
if (has)
{
//
count = detector.CountPeakSWHResPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector
.peakSWHResPivots[i]
.AsBox(iBox);
if (has)
{
//
// iBox.to = cTime;
//
XCBoxObject *iObj;
has = helper.poiDrawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mObjects.Add(iObj);
}
}
//
iBox.Clean();
}
}
}
//
// Draw Vale SWL Sup Pivots ...
if (drawValeSWLSupPivots)
{
//
has = detector.HasValeSWLSupPivots();
if (has)
{
//
count = detector.CountValeSWLSupPivots();
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = detector
.valeSWLSupPivots[i]
.AsBox(iBox);
if (has)
{
//
// iBox.to = cTime;
//
XCBoxObject *iObj;
has = helper.poiDrawer.DrawBox(
iBox,
iObj //
);
if (has)
{
mObjects.Add(iObj);
}
}
//
iBox.Clean();
}
}
}
// //
// Draw KI Bullish Pivots ... // Draw KI Bullish Pivots ...
if (drawKIBullishPivots) if (drawKIBullishPivots)
@@ -713,7 +795,7 @@ class XCXCAEASignaller : XCBase
if (has) if (has)
{ {
// //
iBox.to = cTime; // iBox.to = cTime;
// //
XCBoxObject *iObj; XCBoxObject *iObj;
@@ -752,7 +834,7 @@ class XCXCAEASignaller : XCBase
if (has) if (has)
{ {
// //
iBox.to = cTime; // iBox.to = cTime;
// //
XCBoxObject *iObj; XCBoxObject *iObj;