This commit is contained in:
2025-10-15 13:24:34 +03:30
parent cfe8734715
commit d24610c47b
4 changed files with 1981 additions and 346 deletions
@@ -372,11 +372,11 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
structureConfig,
barIndex //
);
poiDrawer.drawnObjects.Clear();
poiDrawer.DrawMarketStructure(
structure,
structureDrawConfig //
);
// poiDrawer.drawnObjects.Clear();
// poiDrawer.DrawMarketStructure(
// structure,
// structureDrawConfig //
// );
//
// Strategy 1 ...
@@ -391,10 +391,9 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
//
// Strategy 2 ...
has = false;
if (!has)
{
//
// //
// has = Strategy2HasSignal(
// iBar,
// iZone,
@@ -407,6 +406,7 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
//
// Strategy 3 ...
has = false;
if (!has)
{
//
@@ -423,13 +423,13 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
//
has = HasDirection(iDir) &&
iZone.IsValid();
if (has)
{
//
has = false;
iZone.Clean();
iDir = X_DIRECTION_NONE;
}
// if (has)
// {
// //
// has = false;
// iZone.Clean();
// iDir = X_DIRECTION_NONE;
// }
//
if (has)
@@ -442,6 +442,11 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
// TODO: Provided SL ...
double _point = GetPoints(iBar.symbol);
double slAddition = 5 * _point;
double atrAddition = GetAverageTrueRange(
iZone.symbol,
iZone.period,
0 //
);
double slPrice =
isBullish
? iZone.lower - slAddition
@@ -1232,27 +1237,182 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
// Define Requirements ...
bool isBullish = false;
bool isBearish = false;
//
XOHCL pBar;
int barIndex = bar.Index();
int pBarIndex = barIndex + 1;
result = bar.GetPreviousBar(pBar);
if (!result)
{
return result;
}
//
// Do Conditions Checking ...
//
result = fimaHelper.HasMACross(
dir,
barIndex,
structureConfig.maCrossValidationDiffMultiplier //
);
isBullish =
result &&
IsXBullish(dir);
isBearish =
result &&
IsXBearish(dir);
XBoxZone zones[];
int zonesCount = 0;
ENUM_X_PRICE bullishPriceType = X_PRICE_LOW;
ENUM_X_PRICE bearishPriceType = X_PRICE_HIGH;
//
result = isBullish ||
isBearish;
isBullish = fimaHelper.IsSwitchedUnderHKBondLower(bullishPriceType, pBarIndex);
//
isBearish = fimaHelper.IsSwitchedOverHKBondUpper(bearishPriceType, pBarIndex);
//
result =
isBullish ||
isBearish;
//
// Do Validations ...
if (result)
{
//
// Direction Assignment ...
dir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
int lastIDX;
XBoxZone tmpZones[];
int tmpZonesCount = 0;
int validationCount = 0;
ENUM_X_PRICE priceType =
isBullish
? bullishPriceType
: bearishPriceType;
//
// Detect Last Direction Change ...
if (isBullish)
{
result = fimaHelper.FindLastUnderHKBondLower(lastIDX, bullishPriceType, pBarIndex);
}
else
{
result = fimaHelper.FindLastOverHKBondUpper(lastIDX, bearishPriceType, pBarIndex);
}
//
// Validate Direction Changed ...
if (result)
{
//
validationCount = lastIDX - pBarIndex;
result = validationCount >= 10;
}
//
// Collect Zones ...
if (result)
{
//
// Support and Resistances ...
tmpZonesCount = poiDetector.CollectZones(
pBar,
tmpZones,
5,
14, // Zones Validation Length ...
0, // Required Count ...
validationCount // Loopback ...
);
if (IsValidSize(tmpZonesCount))
{
//
Copy(
tmpZones,
zones,
false // ignore Clean ...
);
}
//
// OB ...
tmpZonesCount = poiDetector.CollectOBs(
pBar,
tmpZones,
5, // Zones Loopback ...
0, // Required Count ...
validationCount // Loopback ...
);
if (IsValidSize(tmpZonesCount))
{
//
Copy(
tmpZones,
zones,
false // ignore Clean ...
);
}
//
// FVG ...
tmpZonesCount = poiDetector.CollectFVGs(
pBar,
tmpZones,
5, // Zones Loopback ...
0, // Required Count ...
validationCount // Loopback ...
);
if (IsValidSize(tmpZonesCount))
{
//
Copy(
tmpZones,
zones,
false // ignore Clean ...
);
}
//
// Filter Zones Based on pBar ...
zonesCount = poiDetector.FilterZones(
pBar,
zones,
dir,
priceType,
dir //
);
//
// Extract Affected Zones ...
XClean(tmpZones);
tmpZonesCount = ExtractAffectedZones(
pBar,
zones,
tmpZones,
dir //
);
Copy(tmpZones, zones);
zonesCount = ArraySize(zones);
//
// Update Zones Time ...
UpdateToTime(zones);
}
//
// Draw Zones ...
result = IsValidSize(zonesCount);
if (result)
{
//
for (int i = 0; i < zonesCount; i++)
{
poiDrawer.DrawZone(zones[i], structureDrawConfig.drawConfig);
}
}
//
XClean(tmpZones);
}
//
// Prepare Zone ...
@@ -1260,6 +1420,35 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
{
//
// Zone Detection ...
zone.Clean();
if (isBullish)
{
//
int idx = GetLowest(zones);
if (IsValidIndex(idx))
{
zone = zones[idx];
}
}
else
{
//
int idx = GetHighest(zones);
if (IsValidIndex(idx))
{
zone = zones[idx];
}
}
// zone.dir = dir;
// zone.type = name;
// zone.to = bar.time;
// zone.at = pBar.time;
// zone.from = pBar.time;
// zone.symbol = bar.symbol;
// zone.period = bar.period;
// zone.lower = MathMin(pBar.low, bar.low);
// zone.upper = MathMax(pBar.high, bar.high);
//
result = zone.IsValid();
@@ -1274,6 +1463,7 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
}
//
// Cleanup ...
if (!result)
{
//
@@ -1281,6 +1471,8 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
XClean(targets);
dir = X_DIRECTION_NONE;
}
pBar.Clean();
XClean(zones);
//
return result;