last ...
This commit is contained in:
@@ -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 ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user