This commit is contained in:
2025-09-26 02:17:10 +03:30
parent 4277b25b87
commit 01197f9152
5 changed files with 1216 additions and 510 deletions
+191
View File
@@ -919,3 +919,194 @@ if (has)
{ {
draws.Add(iHighTrend); draws.Add(iHighTrend);
} }
////////////////////////////////////////////////////////
//
// if (HasDirection(marketStructure.signalKeyBarPatternDir))
// {
// Print("Detected ...");
// }
// if (marketStructure.ob.IsValid() && marketStructure.fvg.IsValid())
// {
// Print("Detected ...");
// }
// if (marketStructure.support.IsValid() || marketStructure.resistance.IsValid())
// {
// //
// XOHCL pBar;
// XOHCL p2Bar;
// bool has = cBar.GetPreviousBar(pBar);
// has = has &&
// pBar.GetPreviousBar(p2Bar);
// if (!has)
// {
// //
// pBar.Clean();
// p2Bar.Clean();
// return;
// }
// //
// // Check For PrevZoneExistanse ...
// has = marketStructure.prevZone.IsValid();
// if (has) {
// //
// // Draw Prev Zone ...
// XCBoxObject *iPrevZoneObj;
// marketStructure.prevZone.to = pBar.time;
// has = fima2Signaller.poiDrawer.DrawBox(
// marketStructure.prevZone,
// iPrevZoneObj //
// );
// if (has)
// {
// //
// XPOIStyle style;
// fima2Signaller.poiDrawer.GetBoxStyle(
// style,
// marketStructure.prevZone.dir //
// );
// style.clr = clrYellow;
// fima2Signaller.poiDrawer.ApplyBoxStyle(
// iPrevZoneObj,
// style //
// );
// //
// style.Clean();
// eaDraws.Add(iPrevZoneObj);
// }
// }
// //
// if (has)
// {
// Print("Detected ...");
// }
// //
// // Cleanup Resources ...
// pBar.Clean();
// p2Bar.Clean();
// }
//////////////////////////////////////////////////////////
//
XOHCL pBar;
bool has = cBar.GetPreviousBar(pBar);
if (marketStructure.isPTest)
{
//
// Check For PrevZoneExistanse ...
has = marketStructure.pTestedZone.IsValid();
if (has)
{
//
// Draw Prev Zone ...
XCBoxObject *iPrevZoneObj;
marketStructure.pTestedZone.to = pBar.time;
has = fima2Signaller.poiDrawer.DrawBox(
marketStructure.pTestedZone,
iPrevZoneObj //
);
if (has)
{
//
XPOIStyle style;
fima2Signaller.poiDrawer.GetBoxStyle(
style,
marketStructure.pTestedZone.dir //
);
style.clr = clrYellow;
fima2Signaller.poiDrawer.ApplyBoxStyle(
iPrevZoneObj,
style //
);
//
style.Clean();
eaDraws.Add(iPrevZoneObj);
}
}
//
Print("Previous Tested ...");
}
pBar.Clean();
/////////////////////////////////////////////////////////////
//
// Previous Bar must Has Support or Resistance ...
//
// Check Supports ...
idx = GetYoungestBefore(
pForBar.time,
supports //
);
has =
pForBar.IsValid() &&
IsValidIndex(idx);
if (has)
{
pSupport = supports[idx];
}
//
// Check Resistances ...
idx = GetYoungestBefore(
pForBar.time,
resistances //
);
has =
pForBar.IsValid() &&
IsValidIndex(idx);
if (has)
{
pResistance = resistances[idx];
}
//
bool isPSupportTouched =
pSupport.IsValid() &&
pForBar.low < pSupport.upper;
//
bool isPResistanceTouched =
pResistance.IsValid() &&
pForBar.high > pResistance.lower;
//
has =
isPSupportTouched ||
isPResistanceTouched;
structure.isPTest = has;
if (has)
{
//
if (isPSupportTouched)
{
//
// Validate Previously Tested Zone Price ...
structure.pTestedZone = pSupport;
}
else if (isPResistanceTouched)
{
//
// Validate Previously Tested Zone Price ...
structure.pTestedZone = pResistance;
}
//
}
/////////////////////////////////////////////////////////////
+33 -158
View File
@@ -495,172 +495,47 @@ void OnTick()
} }
// //
// if (HasDirection(marketStructure.signalKeyBarPatternDir)) XOHCL pBar;
// { bool has = cBar.GetPreviousBar(pBar);
// Print("Detected ..."); if (marketStructure.isPTest)
// }
// if (marketStructure.ob.IsValid() && marketStructure.fvg.IsValid())
// {
// Print("Detected ...");
// }
if (marketStructure.support.IsValid() || marketStructure.resistance.IsValid())
{ {
// //
XOHCL pBar; // Check For PrevZoneExistanse ...
XOHCL p2Bar; has = marketStructure.pTestedZone.IsValid();
bool has = cBar.GetPreviousBar(pBar);
has = has &&
pBar.GetPreviousBar(p2Bar);
if (!has)
{
//
pBar.Clean();
p2Bar.Clean();
return;
}
// //
// bool isSupportTouched = marketStructure.isSupportTouched;
// bool isResistanceTouched = marketStructure.isResistanceTouched;
// has =
// isSupportTouched ||
// isResistanceTouched;
// if (!has)
// {
// //
// pBar.Clean();
// return;
// }
// //
// // Here we Have to Detect Previous Support or Resistance ...
// XOHCL prevZoneBar;
// XBoxZone prevZoneBox;
// //
// // Previous Support ...
// bool hasPrevSupport = isSupportTouched &&
// fima2Signaller
// .poiDetector
// .HasSupport(
// pBar,
// prevZoneBar,
// detectorConfig.supportAndResistanceValidationLength,
// detectorConfig.supportAndResistanceMaxAllowedLoopback //
// );
// if (hasPrevSupport)
// {
// hasPrevSupport = ToSupportBox(prevZoneBar, prevZoneBox, pBar.time);
// }
// //
// // Previous Resistance ...
// bool hasPrevResistance = isResistanceTouched &&
// fima2Signaller
// .poiDetector
// .HasSupport(
// pBar,
// prevZoneBar,
// detectorConfig.supportAndResistanceValidationLength,
// detectorConfig.supportAndResistanceMaxAllowedLoopback //
// );
// if (hasPrevResistance)
// {
// hasPrevResistance = ToResistanceBox(prevZoneBar, prevZoneBox, pBar.time);
// }
// //
// has = hasPrevSupport ||
// hasPrevResistance;
// if (!has)
// {
// //
// pBar.Clean();
// prevZoneBox.Clean();
// prevZoneBar.Clean();
// return;
// }
// //
// // Select Youngest ...
// int idx = -1;
// //
// if (hasPrevSupport)
// {
// //
// idx = GetYoungestBefore(
// marketStructure.support.from,
// fima2Signaller.poiDetector.supports //
// );
// has = IsValidIndex(idx);
// if (has)
// {
// //
// prevZoneBox.to = pBar.time;
// prevZoneBox = fima2Signaller.poiDetector.supports[idx];
// }
// }
// //
// if (hasPrevResistance)
// {
// //
// idx = GetYoungestBefore(
// marketStructure.resistance.from,
// fima2Signaller.poiDetector.resistances //
// );
// has = IsValidIndex(idx);
// if (has)
// {
// //
// prevZoneBox.to = pBar.time;
// prevZoneBox = fima2Signaller.poiDetector.resistances[idx];
// }
// }
//
// Draw Prev Zone ...
// XCBoxObject *iPrevZoneObj;
// prevZoneBox.to = pBar.time;
// has = fima2Signaller.poiDrawer.DrawBox(
// prevZoneBox,
// iPrevZoneObj //
// );
// if (has)
// {
// //
// XPOIStyle style;
// fima2Signaller.poiDrawer.GetBoxStyle(
// style,
// prevZoneBox.dir //
// );
// style.clr = clrYellow;
// fima2Signaller.poiDrawer.ApplyBoxStyle(
// iPrevZoneObj,
// style //
// );
// //
// style.Clean();
// eaDraws.Add(iPrevZoneObj);
// }
//
// Check Prev Zone is Breaked or not ...
//
if (has) if (has)
{ {
Print("Detected ..."); //
// Draw Prev Zone ...
XCBoxObject *iPrevZoneObj;
marketStructure.pTestedZone.to = pBar.time;
has = fima2Signaller.poiDrawer.DrawBox(
marketStructure.pTestedZone,
iPrevZoneObj //
);
if (has)
{
//
XPOIStyle style;
fima2Signaller.poiDrawer.GetBoxStyle(
style,
marketStructure.pTestedZone.dir //
);
style.clr = clrYellow;
fima2Signaller.poiDrawer.ApplyBoxStyle(
iPrevZoneObj,
style //
);
//
style.Clean();
eaDraws.Add(iPrevZoneObj);
}
} }
// //
// Cleanup Resources ... Print("Previous Tested ...");
pBar.Clean();
p2Bar.Clean();
// prevZoneBox.Clean();
// prevZoneBar.Clean();
} }
pBar.Clean();
// //
cBar.Clean(); cBar.Clean();
File diff suppressed because it is too large Load Diff
@@ -526,6 +526,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
structure.bar = forBar; structure.bar = forBar;
// //
int idx = -1;
bool has = false; bool has = false;
int maxAllowedCollecting = 50; int maxAllowedCollecting = 50;
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE; ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
@@ -861,6 +862,20 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
// //
XBoxZone supportBox; XBoxZone supportBox;
has = ToSupportBox(support, supportBox); has = ToSupportBox(support, supportBox);
//
// Validate Zone Strength if Provided ...
if (config.minAllowdSupportAndResistanceStrength > 0)
{
//
has = has &&
ValidateStrength(
supportBox,
config.minAllowdSupportAndResistanceStrength //
);
}
//
if (has) if (has)
{ {
// //
@@ -908,6 +923,20 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
// //
XBoxZone resistanceBox; XBoxZone resistanceBox;
has = ToResistanceBox(resistance, resistanceBox); has = ToResistanceBox(resistance, resistanceBox);
//
// Validate Zone Strength if Provided ...
if (config.minAllowdSupportAndResistanceStrength > 0)
{
//
has = has &&
ValidateStrength(
resistanceBox,
config.minAllowdSupportAndResistanceStrength //
);
}
//
if (has) if (has)
{ {
// //
@@ -1014,6 +1043,129 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
structure.zigzagAnalysis = analysis; structure.zigzagAnalysis = analysis;
} }
} }
//
// COMPLEX Actions ...
//
// Lockup For Previous Zone ...
has = structure.isSupportTouched ||
structure.isResistanceTouched;
if (has)
{
//
if (structure.isSupportTouched)
{
//
idx = GetYoungestBefore(
structure.support.from,
supports //
);
has = IsValidIndex(idx);
if (has)
{
structure.prevZone = supports[idx];
}
}
else if (structure.isResistanceTouched)
{
//
idx = GetYoungestBefore(
structure.resistance.from,
resistances //
);
has = IsValidIndex(idx);
if (has)
{
structure.prevZone = resistances[idx];
}
}
}
//
// Checkup for FakeBreaked Zones ...
if (config.detectSupport ||
config.detectResistance)
{
//
// Retrieve Previous Bar ...
int idx = -1;
XOHCL pForBar;
XBoxZone pSupport;
XOHCL pBreakerBar;
XBoxZone pResistance;
has = forBar.GetPreviousBar(pForBar);
if (has)
{
//
// Detecting Nearest Above Lows Support ...
idx = GetYoungestAbove(
pForBar.low,
supports //
);
has = IsValidIndex(idx) &&
IsBreaked(
forBar,
supports[idx] //
);
if (has)
{
pSupport = supports[idx];
}
//
// Detecting Nearest Below Highs Resistance ...
idx = GetYoungestBelow(
pForBar.high,
resistances //
);
has = IsValidIndex(idx) &&
IsBreaked(
forBar,
resistances[idx] //
);
if (has)
{
pResistance = resistances[idx];
}
//
// Check at least a zone Exists ...
has = pSupport.IsValid() ||
pResistance.IsValid();
if (has)
{
//
// Support ...
has = pSupport.IsValid();
if (has)
{
//
structure.isPTest = true;
structure.pTestedZone = pSupport;
// has = FindBreakerBar();
}
//
// Resistance ...
has = pResistance.IsValid();
if (has)
{
//
structure.isPTest = true;
structure.pTestedZone = pResistance;
// has = FindBreakerBar();
}
}
//
// Cleanup Resources ...
pForBar.Clean();
pSupport.Clean();
pBreakerBar.Clean();
pResistance.Clean();
}
}
} }
// //
@@ -86,7 +86,9 @@ struct XFIMAPatternDetectorConfig
// //
// Support and Resistance ... // Support and Resistance ...
int supportAndResistanceValidationLength; int supportAndResistanceValidationLength;
int minAllowdSupportAndResistanceStrength;
int supportAndResistanceMaxAllowedLoopback; int supportAndResistanceMaxAllowedLoopback;
int supportAndResistanceBreakeValidationLength;
// //
// TrueGap ... // TrueGap ...
@@ -161,7 +163,9 @@ struct XFIMAPatternDetectorConfig
trendingNumberOfSwings = 0; trendingNumberOfSwings = 0;
trendingSwingShoulders = 0; trendingSwingShoulders = 0;
supportAndResistanceValidationLength = 0; supportAndResistanceValidationLength = 0;
minAllowdSupportAndResistanceStrength = 0;
supportAndResistanceMaxAllowedLoopback = 0; supportAndResistanceMaxAllowedLoopback = 0;
supportAndResistanceBreakeValidationLength = 0;
truwGapApprovedPointMultiplier = 0; truwGapApprovedPointMultiplier = 0;
flagPatternMinimumPullbackBars = 0; flagPatternMinimumPullbackBars = 0;
momentumBarRangeLength = 0; momentumBarRangeLength = 0;
@@ -176,6 +180,9 @@ struct XFIMAPatternDetectorConfig
maPivotsValidationLength = 0; maPivotsValidationLength = 0;
numberOfRequiredPivotsForAnalysis = 0; numberOfRequiredPivotsForAnalysis = 0;
maxAllowedLoopbackLengthForAnalysis = 0; maxAllowedLoopbackLengthForAnalysis = 0;
//
ZeroMemory(this);
} }
/** /**
@@ -229,7 +236,9 @@ struct XFIMAPatternDetectorConfig
// //
// Support and Resistance ... // Support and Resistance ...
supportAndResistanceValidationLength = 100; supportAndResistanceValidationLength = 100;
minAllowdSupportAndResistanceStrength = 1;
supportAndResistanceMaxAllowedLoopback = 1500; supportAndResistanceMaxAllowedLoopback = 1500;
supportAndResistanceBreakeValidationLength = 3;
// //
// TrueGap ... // TrueGap ...
@@ -360,12 +369,25 @@ struct XFIMAMarketStructure
XBoxZone support; XBoxZone support;
XBoxZone resistance; XBoxZone resistance;
//
// Previous Support or Resistance based on current ...
//
// Current Support is Touched => Prev Support;
// Current Resistance is Touched => Prev Resistance;
XBoxZone prevZone;
// //
bool isOBTouched; bool isOBTouched;
bool isFVGTouched; bool isFVGTouched;
bool isSupportTouched; bool isSupportTouched;
bool isResistanceTouched; bool isResistanceTouched;
//
// TODO: For Test ...
bool isPTest;
XBoxZone pTestedZone;
XBoxZone recentlyTestedZone;
// //
// Analysis ... // Analysis ...
XPivotAnalysis pvAnalysis; XPivotAnalysis pvAnalysis;
@@ -420,6 +442,9 @@ struct XFIMAMarketStructure
isSupportTouched = false; isSupportTouched = false;
isResistanceTouched = false; isResistanceTouched = false;
//
prevZone.Clean();
// //
bar.Clean(); bar.Clean();
flagSwing.Clean(); flagSwing.Clean();
@@ -444,6 +469,9 @@ struct XFIMAMarketStructure
// //
SpecifiedClean(trendSwings); SpecifiedClean(trendSwings);
//
ZeroMemory(this);
} }
// //
@@ -542,6 +570,9 @@ struct XFIMAMarketStructureDrawerConfig
drawFIMAMAPivotsAnalysisPivots = false; drawFIMAMAPivotsAnalysisPivots = false;
drawFIMASARPivotsAnalysisPivots = false; drawFIMASARPivotsAnalysisPivots = false;
drawFIMAZigZagPivotsAnalysisPivots = false; drawFIMAZigZagPivotsAnalysisPivots = false;
//
ZeroMemory(this);
} }
/** /**