This commit is contained in:
2025-09-26 13:20:34 +03:30
parent 01197f9152
commit 353a204162
6 changed files with 605 additions and 64 deletions
@@ -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();
}
}
+6 -1
View File
@@ -85,6 +85,7 @@ struct XFIMAPatternDetectorConfig
//
// Support and Resistance ...
int recentlyTestedZonesMaxLookup;
int supportAndResistanceValidationLength;
int minAllowdSupportAndResistanceStrength;
int supportAndResistanceMaxAllowedLoopback;
@@ -162,6 +163,7 @@ struct XFIMAPatternDetectorConfig
fvgLoopback = 0;
trendingNumberOfSwings = 0;
trendingSwingShoulders = 0;
recentlyTestedZonesMaxLookup = 0;
supportAndResistanceValidationLength = 0;
minAllowdSupportAndResistanceStrength = 0;
supportAndResistanceMaxAllowedLoopback = 0;
@@ -235,6 +237,7 @@ struct XFIMAPatternDetectorConfig
//
// Support and Resistance ...
recentlyTestedZonesMaxLookup = 100;
supportAndResistanceValidationLength = 100;
minAllowdSupportAndResistanceStrength = 1;
supportAndResistanceMaxAllowedLoopback = 1500;
@@ -385,8 +388,9 @@ struct XFIMAMarketStructure
//
// TODO: For Test ...
bool isPTest;
XOHCL pBreakerBar;
XBoxZone pTestedZone;
XBoxZone recentlyTestedZone;
XBoxZone recentlyTestedZones[];
//
// Analysis ...
@@ -469,6 +473,7 @@ struct XFIMAMarketStructure
//
SpecifiedClean(trendSwings);
SpecifiedClean(recentlyTestedZones);
//
ZeroMemory(this);