last ...
This commit is contained in:
@@ -2671,6 +2671,78 @@ class XCMarketPatternDetector : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count Same Bars ...
|
||||
*
|
||||
* @param bar: XOHCL, Specified Bar ...
|
||||
* @param sameBars: XOHCL, collection reference to holds same Bars ...
|
||||
* @param dir: ENUM_X_DIRECTION, refrence to Founded Bars Direction holding ...
|
||||
* @param forDir: ENUM_X_DIRECTION, Specified Looking Bar ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int CountSameBars(
|
||||
XOHCL &bar,
|
||||
XOHCL &sameBars[],
|
||||
ENUM_X_DIRECTION &dir,
|
||||
ENUM_X_DIRECTION forDir //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
// Prepare ...
|
||||
XClean(sameBars);
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
bool has = bar.IsValid();
|
||||
if (!has)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL tmpBar;
|
||||
ENUM_X_DIRECTION tmpDir = forDir;
|
||||
int idx = bar.Index();
|
||||
while (has)
|
||||
{
|
||||
//
|
||||
idx++;
|
||||
tmpBar.Clean();
|
||||
has = bar.BarAt(idx, tmpBar);
|
||||
if (has && !HasDirection(tmpDir))
|
||||
{
|
||||
tmpDir = tmpBar.GetDirection();
|
||||
}
|
||||
has = has &&
|
||||
tmpBar.GetDirection() == tmpDir;
|
||||
if (!has)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
AddIfNotExists(tmpBar, sameBars);
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(sameBars);
|
||||
if (IsValidSize(result))
|
||||
{
|
||||
dir = tmpDir;
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup ...
|
||||
tmpBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Trending ...
|
||||
|
||||
@@ -4414,7 +4486,8 @@ class XCMarketPatternDetector : public XCBase
|
||||
|
||||
//
|
||||
// Validate Zones Range ...
|
||||
if (zonesRangeValidationFactor > 0) {
|
||||
if (zonesRangeValidationFactor > 0)
|
||||
{
|
||||
//
|
||||
double points = GetPoints(bar.symbol);
|
||||
double minAllowedRange = points * zonesRangeValidationFactor;
|
||||
|
||||
Reference in New Issue
Block a user