apply fix on poi detector ...
This commit is contained in:
@@ -524,6 +524,134 @@ class XCXCATBEAPOIDetector : public XCBase
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
barIndex = NormalizeInt(barIndex, 0);
|
||||
int loopback = pivotDetectionLoopbac;
|
||||
loopback = NormalizeInt(loopback, 50);
|
||||
|
||||
//
|
||||
int idx = -1;
|
||||
int count = 0;
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
int zIDX = 0;
|
||||
int cIDX = zIDX + 1;
|
||||
int pIDX = cIDX + 1;
|
||||
int p2IDX = pIDX + 1;
|
||||
int p3IDX = p2IDX + 1;
|
||||
|
||||
//
|
||||
newPeakPivotDetected = false;
|
||||
newValePivotDetected = false;
|
||||
|
||||
//
|
||||
int index = barIndex;
|
||||
int start = index;
|
||||
int end = index + loopback;
|
||||
while (start < end)
|
||||
{
|
||||
//
|
||||
// Retrieve Conditions ...
|
||||
X121XCatbConditions conditions;
|
||||
has = helper.GetConditions(
|
||||
conditions,
|
||||
start,
|
||||
10 //
|
||||
);
|
||||
if (!has)
|
||||
{
|
||||
conditions.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Bars ...
|
||||
XOHCL zBar;
|
||||
XOHCL cBar;
|
||||
XOHCL pBar;
|
||||
XOHCL p2Bar;
|
||||
has = zBar.Init(
|
||||
conditions.symbol,
|
||||
conditions.period,
|
||||
start //
|
||||
);
|
||||
has =
|
||||
has &&
|
||||
zBar.GetPreviousBar(cBar);
|
||||
has =
|
||||
has &&
|
||||
cBar.GetPreviousBar(pBar);
|
||||
has =
|
||||
has &&
|
||||
pBar.GetPreviousBar(p2Bar);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
pBar.Clean();
|
||||
p2Bar.Clean();
|
||||
conditions.Clean();
|
||||
|
||||
//
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Pivots ...
|
||||
|
||||
//
|
||||
// PV ...
|
||||
|
||||
//
|
||||
// PEAK ...
|
||||
if (detectPeakPivots)
|
||||
{
|
||||
//
|
||||
newPeakPivotDetected = DetectPeakAndValePivot(
|
||||
barIndex,
|
||||
X_DIRECTION_BEARISH,
|
||||
zBar,
|
||||
cBar,
|
||||
pBar,
|
||||
p2Bar,
|
||||
conditions //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// VALE ...
|
||||
if (detectValePivots)
|
||||
{
|
||||
//
|
||||
newValePivotDetected = DetectPeakAndValePivot(
|
||||
barIndex,
|
||||
X_DIRECTION_BULLISH,
|
||||
zBar,
|
||||
cBar,
|
||||
pBar,
|
||||
p2Bar,
|
||||
conditions //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Others ...
|
||||
|
||||
//
|
||||
start++;
|
||||
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
pBar.Clean();
|
||||
p2Bar.Clean();
|
||||
conditions.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
SortPivots();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -532,6 +660,18 @@ class XCXCATBEAPOIDetector : public XCBase
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Implement Validation Senarios ...
|
||||
|
||||
//
|
||||
// PV ...
|
||||
ValidatePeakValePivots(
|
||||
unavailables,
|
||||
barIndex //
|
||||
);
|
||||
|
||||
//
|
||||
SortPivots();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -583,7 +723,7 @@ class XCXCATBEAPOIDetector : public XCBase
|
||||
XOHCL &cBar,
|
||||
XOHCL &pBar,
|
||||
XOHCL &p2Bar,
|
||||
XCX121XCatbHelper &conditions //
|
||||
X121XCatbConditions &conditions //
|
||||
)
|
||||
{
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user