last works ...
This commit is contained in:
@@ -1431,6 +1431,225 @@ class XCMarketPatternDetector : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
bool IsContinuationPullbackPattern(
|
||||
XOHCL &bar,
|
||||
XBoxZone &zone,
|
||||
XBoxZone &continuationalZones[],
|
||||
ENUM_X_DIRECTION &dir,
|
||||
XOHCL &continuationalBar,
|
||||
int continuationLength = 3,
|
||||
bool forceContinuationHasZone = true,
|
||||
bool forceContinuationHasPattern = true,
|
||||
int pullbackLength = 2,
|
||||
bool forcePullbackBreak = false,
|
||||
int zonesLoopback = 5,
|
||||
int zonesValidationLength = 5 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Prepare ...
|
||||
zone.Clean();
|
||||
CleanDirection(dir);
|
||||
continuationalBar.Clean();
|
||||
XClean(continuationalZones);
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
zonesLoopback = NormalizeInt(zonesLoopback, 3);
|
||||
pullbackLength = NormalizeInt(pullbackLength, 2);
|
||||
continuationLength = NormalizeInt(continuationLength, 2);
|
||||
zonesValidationLength = NormalizeInt(zonesValidationLength, 3);
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// First we Have to Detect a Pullback ...
|
||||
result = IsPullbackPattern(bar, zone, dir, pullbackLength, forcePullbackBreak);
|
||||
|
||||
//
|
||||
// Select PullBack Start Bar ...
|
||||
XOHCL startBar;
|
||||
result = result &&
|
||||
zone.FromBar(startBar);
|
||||
|
||||
//
|
||||
// Check Continuation Direction ...
|
||||
XOHCL iBar;
|
||||
int start = startBar.Index() + 1;
|
||||
int end = start + continuationLength;
|
||||
for (int i = start; i < end && result; i++)
|
||||
{
|
||||
//
|
||||
// Initialize Indexed Bar ...
|
||||
iBar.Clean();
|
||||
result =
|
||||
result &&
|
||||
bar.BarAt(i, iBar);
|
||||
|
||||
//
|
||||
// Check Direction Same ...
|
||||
result =
|
||||
result &&
|
||||
dir == iBar.GetDirection();
|
||||
|
||||
//
|
||||
if (!result)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Setting Continuational Bar ...
|
||||
if (result)
|
||||
{
|
||||
continuationalBar = iBar;
|
||||
}
|
||||
|
||||
//
|
||||
// Apply Zone Force ...
|
||||
if (result && forceContinuationHasZone)
|
||||
{
|
||||
//
|
||||
XBoxZone tmps[];
|
||||
|
||||
//
|
||||
// Collectiong Support and Resistances ...
|
||||
CollectZones(startBar, tmps, zonesLoopback, zonesValidationLength, 0, zonesLoopback * 2);
|
||||
Copy(tmps, continuationalZones, false);
|
||||
|
||||
//
|
||||
// Collecting Order Blocks ...
|
||||
// CollectOBs(startBar, tmps, zonesLoopback, 0, zonesLoopback * 2);
|
||||
// Copy(tmps, continuationalZones, false);
|
||||
|
||||
//
|
||||
// Collectiong Fair Value Gaps ...
|
||||
CollectFVGs(startBar, tmps, zonesLoopback, 0, zonesLoopback * 2);
|
||||
Copy(tmps, continuationalZones, false);
|
||||
|
||||
//
|
||||
// Extract Directional Zones ...
|
||||
XClean(tmps);
|
||||
ExtractByDirection(tmps, continuationalZones, zone.dir);
|
||||
Copy(tmps, continuationalZones);
|
||||
|
||||
//
|
||||
// Validate Result ...
|
||||
result = result &&
|
||||
HasChild(continuationalZones);
|
||||
|
||||
//
|
||||
XClean(tmps);
|
||||
}
|
||||
|
||||
//
|
||||
// Apply Pattern Force ...
|
||||
if (result && forceContinuationHasPattern)
|
||||
{
|
||||
//
|
||||
bool has = false;
|
||||
int pattersCount = 0;
|
||||
ENUM_X_DIRECTION iPatternDir;
|
||||
for (int i = start; i < end; i++)
|
||||
{
|
||||
//
|
||||
iBar.Clean();
|
||||
CleanDirection(iPatternDir);
|
||||
|
||||
//
|
||||
has = bar.BarAt(i, iBar);
|
||||
if (!has)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Required Patterns ...
|
||||
|
||||
//
|
||||
// Pin Bar ...
|
||||
has = IsPinnedBar(iBar, iPatternDir);
|
||||
has = has &&
|
||||
iPatternDir == zone.dir;
|
||||
if (has)
|
||||
{
|
||||
pattersCount++;
|
||||
}
|
||||
|
||||
//
|
||||
// Engulfed Bar ...
|
||||
has = IsEngulfedBar(iBar, iPatternDir);
|
||||
has = has &&
|
||||
iPatternDir == zone.dir;
|
||||
if (has)
|
||||
{
|
||||
pattersCount++;
|
||||
}
|
||||
|
||||
//
|
||||
// Momentum Bar ...
|
||||
has = IsMomentumBar(iBar, iPatternDir);
|
||||
has = has &&
|
||||
iPatternDir == zone.dir;
|
||||
if (has)
|
||||
{
|
||||
pattersCount++;
|
||||
}
|
||||
|
||||
//
|
||||
// Piercing ...
|
||||
has = IsPiercingPattern(iBar, iPatternDir);
|
||||
has = has &&
|
||||
iPatternDir == zone.dir;
|
||||
if (has)
|
||||
{
|
||||
pattersCount++;
|
||||
}
|
||||
|
||||
//
|
||||
// SignalKey ...
|
||||
has = IsSignalKeyBarPattern(iBar, iPatternDir);
|
||||
has = has &&
|
||||
iPatternDir == zone.dir;
|
||||
if (has)
|
||||
{
|
||||
pattersCount++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
result &&
|
||||
IsValidSize(pattersCount);
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup ...
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
zone.Clean();
|
||||
CleanDirection(dir);
|
||||
continuationalBar.Clean();
|
||||
XClean(continuationalZones);
|
||||
}
|
||||
iBar.Clean();
|
||||
startBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// FVG ...
|
||||
|
||||
@@ -3911,6 +4130,17 @@ class XCMarketPatternDetector : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter Zones ...
|
||||
*
|
||||
* @param bar: XOHCL, reference to Specified Filtering Bar ...
|
||||
* @param source: XBoxZone, reference collection to hold's filtered zones ...
|
||||
* @param filterDir: ENUM_X_DIRECTION, specified Filter Direction ...
|
||||
* @param priceType: ENUM_X_PRICE, Specified Bar's Price type to Use for Filtering Zones ...
|
||||
* @param forDir: ENUM_X_DIRECTION, Specified Zone's Direction to Handle Filtering ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int FilterZones(
|
||||
XOHCL &bar,
|
||||
XBoxZone &source[],
|
||||
|
||||
Reference in New Issue
Block a user