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: