This commit is contained in:
2025-10-28 02:06:48 +03:30
parent 7f81a12949
commit fda0da2d2e
3 changed files with 266 additions and 6 deletions
@@ -2809,7 +2809,7 @@ class XCXFIMAHelperParser : XCBase
//
// Reading Boundary Values ...
//
double maBandUpper = EMPTY_VALUE;
double maBandLower = EMPTY_VALUE;
@@ -3497,6 +3497,109 @@ class XCXFIMAHelperParser : XCBase
return result;
}
/**
* Check Has Boundary Trend or not ...
*
* @param trend: XTrend, refrence to holds Detected trend ...
* @param barIndex: int, Specified Bar Index ...
*
* @return ( bool )
*/
bool HasBoundaryTrend(
XTrend &trend,
int barIndex = 0 //
)
{
//
bool result = false;
//
// Prepare ...
trend.Clean();
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
int pIDX = barIndex + 1;
//
// Select Times ...
datetime toTime = GetBarTime(symbol, period, barIndex);
datetime fromTime = GetBarTime(symbol, period, pIDX);
//
// Reading Min and Max ...
//
double bMax = GetBoundaryMax(barIndex);
double pBMax = GetBoundaryMax(pIDX);
//
double bMin = GetBoundaryMin(barIndex);
double pBMin = GetBoundaryMin(pIDX);
//
bool isBullish =
pBMax < bMax &&
pBMin < bMin;
//
bool isBearish =
pBMax > bMax &&
pBMin > bMin;
//
// Initialize Trend ...
result = isBullish || isBearish;
if (result)
{
//
result = trend.Init(
symbol,
period,
toTime,
isBullish
? pBMin
: pBMax,
fromTime,
isBullish
? bMin
: bMax,
toTime //
);
//
if (!result)
{
trend.Clean();
}
}
//
result = trend.IsValid() &&
trend.HasTrend();
//
// Cleanup ...
if (!result)
{
trend.Clean();
}
//
return result;
}
//
// Protected ...
protected:
@@ -1395,7 +1395,7 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
bool useSignaller1 = false;
bool useSignaller2 = false;
bool useSignaller3 = true;
bool useSignaller4 = true;
bool useSignaller4 = false;
//
// Validator Flags ...
@@ -2565,6 +2565,67 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
zone.lower = MathMin(zone.lower, _fvg.lower);
}
//
// Zone Validation Base ...
result = zone.IsValid();
if (result)
{
//
// Validate By Trend of Zone ...
XTrend zoneTrend;
XTrend zoneToTrend;
//
// Detecting Trends ...
result = poiDetector.HasBoundaryTrend(zone, zoneTrend, false);
result = result &&
poiDetector.HasBoundaryTrend(zone, zoneToTrend, true);
//
// Validate Trend ...
result =
result &&
zone.dir == zoneTrend.dir &&
zone.dir == zoneToTrend.dir;
//
// Draw ...
if (result)
{
//
XPOIDrawConfig iConfig = structureDrawConfig.drawConfig;
iConfig.trendRayLeft = false;
iConfig.trendRayRight = false;
//
poiDrawer.DrawTrendLine(zoneTrend, iConfig);
poiDrawer.DrawTrendLine(zoneToTrend, iConfig);
//
iConfig.Clean();
}
//
if (result)
{
DebugBreak();
}
//
// Cleanup ...
zoneTrend.Clean();
zoneToTrend.Clean();
//
// Reset Flags ...
if (!result) {
//
zone.Clean();
isBullish = false;
isBearish = false;
}
}
//
result = zone.IsValid();
}
@@ -2591,7 +2652,7 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
}
//
// DebugBreak();
DebugBreak();
}
//
@@ -1607,7 +1607,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
//
// Validate ...
bool has = zone.IsValid() &&
fimaParser.IsValid();
fimaParser.IsValid();
if (!has)
{
return result;
@@ -1646,7 +1646,8 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
zone.period,
X_PIVOT_TYPE_PEAK //
);
if (has) {
if (has)
{
upperPivot.prefix = "XBNDUP";
}
@@ -1661,7 +1662,8 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
zone.period,
X_PIVOT_TYPE_VALE //
);
if (has) {
if (has)
{
lowerPivot.prefix = "XBNDLO";
}
@@ -1689,6 +1691,100 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
return result;
}
/**
* Check Zone Has Boundary Trend or not ...
*
* @param zone: XBoxZOne, reference to Specified Zone for Checking Trend ...
* @param trend: XTrend, reference to holds Detected Trend Result ...
* @param basedOnToTime: bool, if set true, do based on to and it's prev bar ...
*
* @return ( bool )
*/
bool HasBoundaryTrend(
XBoxZone &zone,
XTrend &trend,
bool basedOnToTime = false //
)
{
//
bool result = false;
//
// Prepare ...
trend.Clean();
//
// Validate ...
result =
zone.IsValid() &&
fimaParser.IsValid();
if (!result)
{
return result;
}
//
// Do ...
//
int toIDX = zone.ToIndex();
int fromIDX =
basedOnToTime
? toIDX + 1
: zone.FromIndex();
datetime fromTime = GetBarTime(zone.symbol, zone.period, fromIDX);
//
double toMin = fimaParser.GetBoundaryMin(toIDX);
double toMax = fimaParser.GetBoundaryMax(toIDX);
//
double fromMin = fimaParser.GetBoundaryMin(fromIDX);
double fromMax = fimaParser.GetBoundaryMax(fromIDX);
//
bool isMinBullish = fromMin < toMin;
bool isMaxBullish = fromMax < toMax;
bool isBullish = isMinBullish && isMaxBullish;
//
bool isMinBearish = fromMin > toMin;
bool isMaxBearish = fromMax > toMax;
bool isBearish = isMinBearish && isMaxBearish;
//
result = isBullish || isBearish;
if (result)
{
//
result = trend.Init(
zone.symbol,
zone.period,
TimeCurrent(),
isBullish
? fromMin
: fromMax,
fromTime,
isBullish
? toMin
: toMax,
zone.to //
);
}
//
// Validate Result ...
result = trend.IsValid() &&
trend.HasTrend();
if (!result)
{
trend.Clean();
}
//
return result;
}
//
// Others ...