last works ...

This commit is contained in:
2025-10-02 20:23:31 +03:30
parent bb8ab13739
commit b77771b2fc
8 changed files with 3537 additions and 87 deletions
@@ -415,8 +415,8 @@ class XCXFIMABaseSignaller : public XCBaseSignaller
//
// Retrieve MA Band for Validation ...
double iMABandUpper = fimaConditions.maBandUpperBuffer[0];
double iMABandLower = fimaConditions.maBandLowerBuffer[0];
double iMABandUpper = fimaConditions.maBondUpperBuffer[0];
double iMABandLower = fimaConditions.maBondLowerBuffer[0];
//
// Validate by Edge Price ...
@@ -578,6 +578,9 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
// XBoxZone iBox;
// XCBoxObject *iBoxObj;
//
// poiDrawer.RemoveDraws();
// //
// has = iStructure.pvAnalysis.HasSupportBox(iBox);
// if (has)
@@ -608,21 +611,71 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
// }
// }
// //
// // Draw Zones ...
// has = HasChild(iStructure.supports);
// if (has) {
// //
// CArrayObj *iSupportObjs;
// poiDrawer.DrawBoxes(
// iStructure.supports,
// iSupportObjs,
// true //
// );
// }
// //
// has = HasChild(iStructure.resistances);
// if (has) {
// //
// CArrayObj *iResistanceObjs;
// poiDrawer.DrawBoxes(
// iStructure.resistances,
// iResistanceObjs,
// true //
// );
// }
//
// Detecte Fibo Section Changes ...
//
has = fimaHelper.IsFiboSectionChanged(iDir, iBar.Index());
has = has &&
IsXBullish(iDir) &&
fimaHelper.IsValeOverLast(iBar.Index());
//
has = fimaHelper.IsFiboSectionChanged(iDir, iBar.Index());
has = has &&
IsXBearish(iDir) &&
fimaHelper.IsPeakUnderLast(iBar.Index());
//
has = fimaHelper.HasFiboPush(iDir, iBar.Index(), 5);
//
if (has)
{
Print("Draw Zones ...");
}
//
// Disable Signallers ...
has = false;
iDir = X_DIRECTION_NONE;
//
// Strategy 1 ...
// Works on Support or Resistances Areas ...
has = Strategy1HasSignal(
iBar,
iZone,
iTargets,
iDir,
iFIMAConditions,
iStructure //
);
// has = Strategy1HasSignal(
// iBar,
// iZone,
// iTargets,
// iDir,
// iFIMAConditions,
// iStructure //
// );
//
// Strategy 2 ...
@@ -476,6 +476,138 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
return result;
}
int ExtractXFIMAZones(
XBoxZone &zones[],
int barIndex = 0,
int requiredNumberOfZones = 50,
double shadowMultiplier = 4,
int maxAllowedLoopbackLength = 1500 //
)
{
//
int result = 0;
//
// Prepare ...
XClean(zones);
//
// Normalize ...
barIndex = NormalizeInt(barIndex, 0);
shadowMultiplier = NormalizeDouble(shadowMultiplier, 2);
requiredNumberOfZones = NormalizeInt(requiredNumberOfZones, 5);
maxAllowedLoopbackLength = NormalizeInt(maxAllowedLoopbackLength, 50);
//
// Validate ...
bool has =
fimaHelper != NULL &&
fimaHelper.IsValid();
if (!has)
{
return result;
}
//
// Create a Loop ...
XOHCL iBar;
XBoxZone iBox;
bool isBullish = false;
bool isBearish = false;
double iUpper = EMPTY_VALUE;
double iLower = EMPTY_VALUE;
double iHKUpper = EMPTY_VALUE;
double iHKLower = EMPTY_VALUE;
double iMAUpper = EMPTY_VALUE;
double iMALower = EMPTY_VALUE;
string symbol = fimaHelper.GetSymbol();
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
ENUM_TIMEFRAMES period = fimaHelper.GetPeriod();
//
int start = barIndex;
int idx = start - 1;
int end = start + maxAllowedLoopbackLength;
while (ArraySize(zones) < requiredNumberOfZones && idx < end)
{
//
idx++;
//
// Initialize Indexed Bar ...
has = iBar.Init(
symbol,
period,
idx //
);
if (!has)
{
continue;
}
//
// Reading Bars ...
iMAUpper = fimaHelper.GetMABondUpper(idx);
iMALower = fimaHelper.GetMABondLower(idx);
iHKUpper = fimaHelper.GetHKBondUpper(idx);
iHKLower = fimaHelper.GetHKBondLower(idx);
//
iUpper = MathMax(iMAUpper, iHKUpper);
iLower = MathMin(iMALower, iHKLower);
//
// Check Bar State ...
has =
NotEmptyZero(iUpper) &&
NotEmptyZero(iLower);
if (!has)
{
continue;
}
//
// Check Direction of Zone ...
isBullish = iBar.low < iLower;
isBearish = iBar.high > iUpper;
has = (isBullish && !isBearish) ||
(isBearish && !isBullish);
if (!has)
{
continue;
}
//
// Validate Shadow Multiplier ...
has =
isBullish
? iBar.GetLowShadow() > iBar.GetHighShadow() * shadowMultiplier
: iBar.GetHighShadow() > iBar.GetLowShadow() * shadowMultiplier;
if (!has)
{
continue;
}
//
iDir = isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
//
// Cleanup Resources ...
iBar.Clean();
iBox.Clean();
}
//
result = ArraySize(zones);
//
return result;
}
/**
* Destroy ...
*/
@@ -1434,6 +1566,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
//
// OBS ...
CheckZones(forBar, obs);
UpdateToTime(obs, forBar.time);
Copy(
obs,
structure.obs //
@@ -1442,6 +1575,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
//
// FVGS ...
CheckZones(forBar, fvgs);
UpdateToTime(fvgs, forBar.time);
Copy(
fvgs,
structure.fvgs //
@@ -1450,6 +1584,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
//
// SUPPORTS ...
CheckZones(forBar, supports);
UpdateToTime(supports, forBar.time);
Copy(
supports,
structure.supports //
@@ -1458,6 +1593,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
//
// RESISTANCES ...
CheckZones(forBar, resistances);
UpdateToTime(resistances, forBar.time);
Copy(
resistances,
structure.resistances //