last works ...
This commit is contained in:
@@ -4264,6 +4264,100 @@ class XCMarketPatternDetector : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Trigger Bar ...
|
||||
bool IsTriggerBar(
|
||||
XOHCL &bar,
|
||||
ENUM_X_DIRECTION forDir,
|
||||
ENUM_TIMEFRAMES forPeriod = PERIOD_M1 //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Trigger Bars Detected in Specified Perido ...
|
||||
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result = bar.IsValid() &&
|
||||
IsXValid(forPeriod) &&
|
||||
HasDirection(forDir);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Do ...
|
||||
|
||||
//
|
||||
// Initialized Specified Bar in Specified Time Frame ...
|
||||
XOHCL periodBar;
|
||||
int index = GetBarIndex(
|
||||
bar.symbol,
|
||||
forPeriod,
|
||||
TimeCurrent() //
|
||||
);
|
||||
result = periodBar.Init(bar.symbol, forPeriod, index);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Pattern ...
|
||||
XPatternAnalysisConfig iConfig;
|
||||
iConfig.Default();
|
||||
iConfig.CleanPatterns();
|
||||
iConfig.AddPattern(X_BAR_PATTERN_LOW);
|
||||
iConfig.AddPattern(X_BAR_PATTERN_HIGH);
|
||||
iConfig.AddPattern(X_BAR_PATTERN_PINNED);
|
||||
iConfig.AddPattern(X_BAR_PATTERN_ENGULFED);
|
||||
iConfig.AddPattern(X_BAR_PATTERN_SIGNALKEY);
|
||||
|
||||
//
|
||||
XPatternAnalysis periodBarAnalysis;
|
||||
result = AnalyseBarPatterns(periodBar, periodBarAnalysis, iConfig);
|
||||
|
||||
//
|
||||
bool isBullish =
|
||||
result &&
|
||||
IsXBullish(forDir) &&
|
||||
(
|
||||
//
|
||||
periodBarAnalysis.HasPattern(X_BAR_PATTERN_PINNED, X_DIRECTION_BULLISH) ||
|
||||
periodBarAnalysis.HasPattern(X_BAR_PATTERN_ENGULFED, X_DIRECTION_BULLISH) ||
|
||||
periodBarAnalysis.HasPattern(X_BAR_PATTERN_SIGNALKEY, X_DIRECTION_BULLISH)
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
bool isBearish =
|
||||
result &&
|
||||
IsXBearish(forDir) &&
|
||||
(
|
||||
//
|
||||
periodBarAnalysis.HasPattern(X_BAR_PATTERN_PINNED, X_DIRECTION_BEARISH) ||
|
||||
periodBarAnalysis.HasPattern(X_BAR_PATTERN_ENGULFED, X_DIRECTION_BEARISH) ||
|
||||
periodBarAnalysis.HasPattern(X_BAR_PATTERN_SIGNALKEY, X_DIRECTION_BEARISH)
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
// Summarize Result ...
|
||||
result = isBullish || isBearish;
|
||||
|
||||
//
|
||||
// Cleanup ...
|
||||
iConfig.Clean();
|
||||
periodBar.Clean();
|
||||
periodBarAnalysis.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user