last ...
This commit is contained in:
@@ -1082,6 +1082,67 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Recently Tested Zones ...
|
||||
if ((config.detectSupport ||
|
||||
config.detectResistance) &&
|
||||
config.recentlyTestedZonesMaxLookup > 0)
|
||||
{
|
||||
//
|
||||
XOHCL iBar;
|
||||
int idx = -1;
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
int start = forBar.Index() + 1;
|
||||
int end = start + config.recentlyTestedZonesMaxLookup;
|
||||
for (int i = start; i < end; i++) {
|
||||
//
|
||||
// Initialize Indexed Bar ...
|
||||
has = forBar.BarAt(i, iBar);
|
||||
if (!has) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Selecting Support and Resistances ...
|
||||
|
||||
//
|
||||
// Supports ...
|
||||
idx = GetYoungestBefore(iBar.time, supports);
|
||||
has = IsValidIndex(idx);
|
||||
if (has) {
|
||||
//
|
||||
// Check Testing ...
|
||||
has = IsTested(iBar, supports[idx]);
|
||||
if (has) {
|
||||
//
|
||||
AddIfNotExists(
|
||||
supports[idx],
|
||||
structure.recentlyTestedZones //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Resistances ...
|
||||
idx = GetYoungestBefore(iBar.time, resistances);
|
||||
has = IsValidIndex(idx);
|
||||
if (has) {
|
||||
//
|
||||
// Check Testing ...
|
||||
has = IsTested(iBar, resistances[idx]);
|
||||
if (has) {
|
||||
//
|
||||
AddIfNotExists(
|
||||
resistances[idx],
|
||||
structure.recentlyTestedZones //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Checkup for FakeBreaked Zones ...
|
||||
if (config.detectSupport ||
|
||||
@@ -1091,9 +1152,13 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
|
||||
// Retrieve Previous Bar ...
|
||||
int idx = -1;
|
||||
XOHCL pForBar;
|
||||
XOHCL breakerBar;
|
||||
XBoxZone pSupport;
|
||||
XOHCL pBreakerBar;
|
||||
XBoxZone pResistance;
|
||||
|
||||
//
|
||||
// Selecting Previously Touched Support / Resistance ...
|
||||
has = forBar.GetPreviousBar(pForBar);
|
||||
if (has)
|
||||
{
|
||||
@@ -1128,43 +1193,90 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
|
||||
{
|
||||
pResistance = resistances[idx];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check at least a zone Exists ...
|
||||
// Selecting pTestedZone ...
|
||||
has = pSupport.IsValid() ||
|
||||
pResistance.IsValid();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Check at least a zone Exists ...
|
||||
has = pSupport.IsValid() ||
|
||||
pResistance.IsValid();
|
||||
// Support ...
|
||||
has = pSupport.IsValid();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Support ...
|
||||
has = pSupport.IsValid();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
structure.isPTest = true;
|
||||
structure.pTestedZone = pSupport;
|
||||
// has = FindBreakerBar();
|
||||
}
|
||||
structure.isPTest = true;
|
||||
structure.pTestedZone = pSupport;
|
||||
}
|
||||
|
||||
//
|
||||
// Resistance ...
|
||||
has = pResistance.IsValid();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Resistance ...
|
||||
has = pResistance.IsValid();
|
||||
structure.isPTest = true;
|
||||
structure.pTestedZone = pResistance;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check pTestedZone Existance ...
|
||||
has = structure.isPTest &&
|
||||
structure.pTestedZone.IsValid();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Get Breaker Bars ...
|
||||
XOHCL breakerBars[];
|
||||
int breakerBarsCount = GetBreakerBars(
|
||||
structure.pTestedZone,
|
||||
breakerBars //
|
||||
);
|
||||
has = IsValidSize(breakerBarsCount);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
idx = GetYoungestBar(breakerBars);
|
||||
has = IsValidIndex(idx);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
structure.isPTest = true;
|
||||
structure.pTestedZone = pResistance;
|
||||
// has = FindBreakerBar();
|
||||
breakerBar = breakerBars[idx];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
pForBar.Clean();
|
||||
pSupport.Clean();
|
||||
pBreakerBar.Clean();
|
||||
pResistance.Clean();
|
||||
SpecifiedClean(breakerBars);
|
||||
}
|
||||
|
||||
//
|
||||
// Check Zone Breaker Bar Exists ...
|
||||
// Validate Zone Fake Breake Langth ...
|
||||
has = breakerBar.IsValid();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Validate Breake Length ...
|
||||
has = (breakerBar.Index() - pForBar.Index()) <= config.supportAndResistanceBreakeValidationLength;
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
//
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
structure.isPTest = false;
|
||||
structure.pTestedZone.Clean();
|
||||
}
|
||||
pForBar.Clean();
|
||||
pSupport.Clean();
|
||||
breakerBar.Clean();
|
||||
pBreakerBar.Clean();
|
||||
pResistance.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user