last works ...
This commit is contained in:
@@ -284,7 +284,7 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
|
||||
//
|
||||
// Ignore Signal Targets ...
|
||||
ignoreTargets = true;
|
||||
ignoreTargets = false;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -331,9 +331,7 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
string iName = NULL;
|
||||
bool isBullish = false;
|
||||
bool isBearish = false;
|
||||
XPatternAnalysis iBarAnalysis;
|
||||
XFIMAConditions iFIMAConditions;
|
||||
XFIMAMarketStructure iStructure;
|
||||
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
@@ -380,22 +378,35 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
structureDrawConfig //
|
||||
);
|
||||
|
||||
// //
|
||||
// // Testing Porposes ...
|
||||
// has = fimaHelper.IsBoundaryFakeBreaked(
|
||||
// iDir,
|
||||
// barIndex,
|
||||
// X_PRICE_CLOSE,
|
||||
// X_PRICE_CLOSE //
|
||||
// );
|
||||
// if (has)
|
||||
// {
|
||||
// Print("Faked Break ...");
|
||||
// }
|
||||
|
||||
//
|
||||
// Disable Signallers ...
|
||||
has = false;
|
||||
iDir = X_DIRECTION_NONE;
|
||||
// has = false;
|
||||
// iDir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
// Strategy 1 ...
|
||||
// Works on Support or Resistances Areas ...
|
||||
// has = Strategy1HasSignal(
|
||||
// iBar,
|
||||
// iZone,
|
||||
// iTargets,
|
||||
// iDir,
|
||||
// iFIMAConditions,
|
||||
// iStructure //
|
||||
// );
|
||||
has = Strategy1HasSignal(
|
||||
iBar,
|
||||
iZone,
|
||||
iTargets,
|
||||
iDir,
|
||||
iFIMAConditions,
|
||||
structure //
|
||||
);
|
||||
|
||||
//
|
||||
// Strategy 2 ...
|
||||
@@ -409,7 +420,7 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
// iTargets,
|
||||
// iDir,
|
||||
// iFIMAConditions,
|
||||
// iStructure //
|
||||
// structure //
|
||||
// );
|
||||
}
|
||||
|
||||
@@ -462,8 +473,6 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
iBar.Clean();
|
||||
iZone.Clean();
|
||||
iSignal.Clean();
|
||||
iStructure.Clean();
|
||||
iBarAnalysis.Clean();
|
||||
iFIMAConditions.Clean();
|
||||
SpecifiedClean(iTargets);
|
||||
}
|
||||
@@ -543,6 +552,180 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Testing Porposes ...
|
||||
result = fimaHelper.IsBoundaryFakeBreaked(
|
||||
dir,
|
||||
bar.Index(),
|
||||
X_PRICE_CLOSE,
|
||||
X_PRICE_CLOSE //
|
||||
);
|
||||
|
||||
//
|
||||
// Nearest Noisy ZG Pivot Must has Same Direction
|
||||
// by Boundary Faked Break ...
|
||||
result =
|
||||
result &&
|
||||
HasDirection(dir) &&
|
||||
_structure.zgAnalysis.IsValid() &&
|
||||
_structure.zgAnalysis.HasPivots() &&
|
||||
_structure.zgAnalysis.pivots[0].dir == dir;
|
||||
|
||||
//
|
||||
// We Have to Detect a Zone which Nearest ZG Pivot Reject or goes inside it ...
|
||||
|
||||
//
|
||||
int idx = -1;
|
||||
XOHCL tmpBar;
|
||||
XPivot pivot;
|
||||
XPivot pivots[];
|
||||
XBoxZone zones[];
|
||||
bool has = false;
|
||||
int zonesCount = 0;
|
||||
int pivotIndex = -1;
|
||||
XBoxZone affectedZone;
|
||||
double bullishScore = 0;
|
||||
double bearishScore = 0;
|
||||
int prevPivotIndex = -1;
|
||||
XBoxZone affectedZones[];
|
||||
int affectedZonesCount = 0;
|
||||
|
||||
//
|
||||
Copy(
|
||||
_structure.zgAnalysis.pivots,
|
||||
pivots //
|
||||
);
|
||||
pivot = pivots[0];
|
||||
ArrayRemove(pivots, 0, 1);
|
||||
|
||||
//
|
||||
bool isBullish = IsXBullish(dir);
|
||||
bool isBearish = IsXBearish(dir);
|
||||
|
||||
//
|
||||
zonesCount = _structure.CollectZones(
|
||||
zones,
|
||||
dir //
|
||||
);
|
||||
result = result &&
|
||||
IsValidSize(zonesCount);
|
||||
|
||||
//
|
||||
// Noisey ZG Pivot must inside atleast one of Zones ...
|
||||
|
||||
//
|
||||
// Initial Pivots Bar ...
|
||||
result =
|
||||
result &&
|
||||
bar.BarAt(pivot.time, tmpBar);
|
||||
|
||||
//
|
||||
// Extract Affected Zones ...
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
affectedZonesCount = ExtractAffectedZones(
|
||||
tmpBar,
|
||||
zones,
|
||||
affectedZones,
|
||||
dir //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Affected Zones ...
|
||||
result =
|
||||
result &&
|
||||
HasChild(affectedZones) &&
|
||||
affectedZonesCount >= 1;
|
||||
if (result)
|
||||
{
|
||||
affectedZone = affectedZones[0];
|
||||
}
|
||||
result =
|
||||
result &&
|
||||
affectedZone.IsValid() &&
|
||||
(isBullish
|
||||
? bar.close > affectedZone.upper
|
||||
: bar.close < affectedZone.lower);
|
||||
|
||||
//
|
||||
// There Must another Same Directional ZG Pivot Exists
|
||||
// which is Affect another Zone ...
|
||||
idx = GetYoungest(pivots, pivot.type);
|
||||
result =
|
||||
result &&
|
||||
IsValidIndex(idx) &&
|
||||
affectedZone.IsValid() &&
|
||||
(isBullish
|
||||
? pivots[idx].value < pivot.value
|
||||
: pivots[idx].value > pivot.value);
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
pivot.Clean();
|
||||
tmpBar.Clean();
|
||||
pivot = pivots[idx];
|
||||
XClean(affectedZones);
|
||||
ArrayRemove(pivots, idx, 1);
|
||||
|
||||
//
|
||||
result = bar.BarAt(pivot.time, tmpBar);
|
||||
}
|
||||
|
||||
//
|
||||
// Extract Affected Zones ...
|
||||
XClean(affectedZones);
|
||||
affectedZonesCount = 0;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
affectedZonesCount = ExtractAffectedZones(
|
||||
tmpBar,
|
||||
zones,
|
||||
affectedZones,
|
||||
dir //
|
||||
);
|
||||
}
|
||||
result =
|
||||
result &&
|
||||
HasChild(affectedZones) &&
|
||||
affectedZonesCount >= 1;
|
||||
|
||||
//
|
||||
// Handling Scores ...
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < ArraySize(_structure.barsAnalysis); i++)
|
||||
{
|
||||
//
|
||||
bullishScore += _structure.barsAnalysis[i].Count(X_DIRECTION_BULLISH);
|
||||
bearishScore += _structure.barsAnalysis[i].Count(X_DIRECTION_BEARISH);
|
||||
}
|
||||
}
|
||||
result =
|
||||
isBullish
|
||||
? bullishScore > bearishScore
|
||||
: bearishScore > bullishScore;
|
||||
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
dir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Validating ...
|
||||
// Print("Validate ZG ...");
|
||||
|
||||
// //
|
||||
// dir = X_DIRECTION_NONE;
|
||||
// result = false;
|
||||
|
||||
//
|
||||
// Prepare zone ...
|
||||
if (result)
|
||||
@@ -554,12 +737,43 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
bar.period,
|
||||
bar.Index() + 2 //
|
||||
);
|
||||
zone.dir = dir;
|
||||
zone.symbol = bar.symbol;
|
||||
zone.period = bar.period;
|
||||
// zone.dir = structure.maCrossDir;
|
||||
zone.lower = bar.FindLowest(2, MODE_LOW);
|
||||
zone.upper = bar.FindHighest(2, MODE_HIGH);
|
||||
// zone.type = name + "_" + ToXString(structure.maCrossDir);
|
||||
zone.type = name + "_" + ToXString(dir);
|
||||
// zone.lower = bar.FindLowest(2, MODE_LOW);
|
||||
// zone.upper = bar.FindHighest(2, MODE_HIGH);
|
||||
double entry = GetEntry(bar.symbol, dir);
|
||||
double points = GetPoints(bar.symbol);
|
||||
zone.lower = entry - (100 * points);
|
||||
zone.upper = entry + (100 * points);
|
||||
|
||||
//
|
||||
double tp1 = isBullish
|
||||
? entry + (100 * points)
|
||||
: entry - (100 * points);
|
||||
XTarget target1;
|
||||
target1.target = tp1;
|
||||
target1.doRF = true;
|
||||
target1.actingDistance = 10;
|
||||
|
||||
double tp2 = isBullish
|
||||
? entry + (200 * points)
|
||||
: entry - (200 * points);
|
||||
XTarget target2;
|
||||
target2.target = tp2;
|
||||
target2.doRF = true;
|
||||
target2.actingDistance = 10;
|
||||
|
||||
//
|
||||
// AddRef(
|
||||
// target1,
|
||||
// targets //
|
||||
// );
|
||||
AddRef(
|
||||
target2,
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
result = zone.IsValid();
|
||||
@@ -577,7 +791,7 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
// Cleanup ...
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
@@ -585,6 +799,14 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
XClean(targets);
|
||||
}
|
||||
|
||||
//
|
||||
pivot.Clean();
|
||||
XClean(zones);
|
||||
tmpBar.Clean();
|
||||
XClean(pivots);
|
||||
affectedZone.Clean();
|
||||
XClean(affectedZones);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user