Last works ...
This commit is contained in:
@@ -639,20 +639,49 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
//
|
||||
// Detecte Fibo Section Changes ...
|
||||
|
||||
//
|
||||
has = fimaHelper.IsFiboSectionChanged(iDir, iBar.Index());
|
||||
has = has &&
|
||||
IsXBullish(iDir) &&
|
||||
fimaHelper.IsValeOverLast(iBar.Index());
|
||||
// //
|
||||
// has = fimaHelper.IsFiboSectionChanged(iDir, iBar.Index());
|
||||
// has = has &&
|
||||
// IsXBullish(iDir) &&
|
||||
// fimaHelper.IsValeOverLast(iBar.Index());
|
||||
|
||||
// //
|
||||
// has = fimaHelper.IsFiboSectionChanged(iDir, iBar.Index());
|
||||
// has = has &&
|
||||
// IsXBearish(iDir) &&
|
||||
// fimaHelper.IsPeakUnderLast(iBar.Index());
|
||||
|
||||
// //
|
||||
// has = fimaHelper.HasFiboPush(iDir, iBar.Index(), 5);
|
||||
|
||||
//
|
||||
has = fimaHelper.IsFiboSectionChanged(iDir, iBar.Index());
|
||||
has = has &&
|
||||
IsXBearish(iDir) &&
|
||||
fimaHelper.IsPeakUnderLast(iBar.Index());
|
||||
|
||||
//
|
||||
has = fimaHelper.HasFiboPush(iDir, iBar.Index(), 5);
|
||||
XBoxZone fimaZones[];
|
||||
int fimaZonesCount = fimaHelper.DetectXFIMAZones(
|
||||
fimaZones,
|
||||
iBar.Index(),
|
||||
true, // Only Valid Zones ...
|
||||
50, // Number of Zones ...
|
||||
5, // Shadow Multiplier ...
|
||||
500 // Loopback
|
||||
);
|
||||
has = IsValidSize(fimaZonesCount);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Draw Detected Zones ...
|
||||
CArrayObj zoneObjects;
|
||||
for (int i = 0; i < fimaZonesCount; i++)
|
||||
{
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = poiDrawer.DrawBox(
|
||||
fimaZones[i],
|
||||
iObj,
|
||||
false, // Ignore At ...
|
||||
fimaZones[i].type // Specified Name ...
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (has)
|
||||
|
||||
@@ -476,138 +476,6 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
|
||||
return result;
|
||||
}
|
||||
|
||||
int ExtractXFIMAZones(
|
||||
XBoxZone &zones[],
|
||||
int barIndex = 0,
|
||||
int requiredNumberOfZones = 50,
|
||||
double shadowMultiplier = 4,
|
||||
int maxAllowedLoopbackLength = 1500 //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
// Prepare ...
|
||||
XClean(zones);
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
barIndex = NormalizeInt(barIndex, 0);
|
||||
shadowMultiplier = NormalizeDouble(shadowMultiplier, 2);
|
||||
requiredNumberOfZones = NormalizeInt(requiredNumberOfZones, 5);
|
||||
maxAllowedLoopbackLength = NormalizeInt(maxAllowedLoopbackLength, 50);
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
bool has =
|
||||
fimaHelper != NULL &&
|
||||
fimaHelper.IsValid();
|
||||
if (!has)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Create a Loop ...
|
||||
XOHCL iBar;
|
||||
XBoxZone iBox;
|
||||
bool isBullish = false;
|
||||
bool isBearish = false;
|
||||
double iUpper = EMPTY_VALUE;
|
||||
double iLower = EMPTY_VALUE;
|
||||
double iHKUpper = EMPTY_VALUE;
|
||||
double iHKLower = EMPTY_VALUE;
|
||||
double iMAUpper = EMPTY_VALUE;
|
||||
double iMALower = EMPTY_VALUE;
|
||||
string symbol = fimaHelper.GetSymbol();
|
||||
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
|
||||
ENUM_TIMEFRAMES period = fimaHelper.GetPeriod();
|
||||
|
||||
//
|
||||
int start = barIndex;
|
||||
int idx = start - 1;
|
||||
int end = start + maxAllowedLoopbackLength;
|
||||
while (ArraySize(zones) < requiredNumberOfZones && idx < end)
|
||||
{
|
||||
//
|
||||
idx++;
|
||||
|
||||
//
|
||||
// Initialize Indexed Bar ...
|
||||
has = iBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
idx //
|
||||
);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Reading Bars ...
|
||||
iMAUpper = fimaHelper.GetMABondUpper(idx);
|
||||
iMALower = fimaHelper.GetMABondLower(idx);
|
||||
iHKUpper = fimaHelper.GetHKBondUpper(idx);
|
||||
iHKLower = fimaHelper.GetHKBondLower(idx);
|
||||
|
||||
//
|
||||
iUpper = MathMax(iMAUpper, iHKUpper);
|
||||
iLower = MathMin(iMALower, iHKLower);
|
||||
|
||||
//
|
||||
// Check Bar State ...
|
||||
has =
|
||||
NotEmptyZero(iUpper) &&
|
||||
NotEmptyZero(iLower);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Direction of Zone ...
|
||||
isBullish = iBar.low < iLower;
|
||||
isBearish = iBar.high > iUpper;
|
||||
has = (isBullish && !isBearish) ||
|
||||
(isBearish && !isBullish);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Shadow Multiplier ...
|
||||
has =
|
||||
isBullish
|
||||
? iBar.GetLowShadow() > iBar.GetHighShadow() * shadowMultiplier
|
||||
: iBar.GetHighShadow() > iBar.GetLowShadow() * shadowMultiplier;
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
iDir = isBullish
|
||||
? X_DIRECTION_BULLISH
|
||||
: X_DIRECTION_BEARISH;
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
iBar.Clean();
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(zones);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy ...
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user