add XTargetManager Class and use it in XBacktesterEA Class ...
also i have to implement it's usage on XCExpert Class ... extends XTarget approaches and add support to Distances ...
This commit is contained in:
@@ -804,22 +804,6 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
CArrayObj *zoneObjs;
|
||||
poiDrawer.DrawBoxes(
|
||||
supports,
|
||||
zoneObjs //
|
||||
);
|
||||
poiDrawer.DrawBoxes(
|
||||
resistances,
|
||||
zoneObjs //
|
||||
);
|
||||
poiDrawer.DrawBoxes(
|
||||
structure.fvgs,
|
||||
zoneObjs,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
// Check Affected Zone ...
|
||||
// Select a Support or Resistance ...
|
||||
@@ -878,6 +862,132 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
|
||||
//
|
||||
// Check Reversal FVGS ...
|
||||
int idx = -1;
|
||||
XTarget target;
|
||||
XBoxZone targetZones[];
|
||||
int numberOfTargets = 3;
|
||||
double actingDistance = 20;
|
||||
double iValue = EMPTY_VALUE;
|
||||
bool ignoreFirstTarget = true;
|
||||
ENUM_X_DIRECTION targetsDir = Opposit(dir);
|
||||
int count = ExtractByDirection(
|
||||
targetZones,
|
||||
structure.fvgs,
|
||||
targetsDir //
|
||||
);
|
||||
bool has = IsValidSize(count);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Calculate Value ...
|
||||
double points = GetPoints(zone.symbol);
|
||||
double zoneRange = zone.upper - zone.lower;
|
||||
iValue = IsXBullish(dir)
|
||||
? (zone.upper + (zoneRange * defaultSignalR2R))
|
||||
: (zone.lower + (zoneRange * defaultSignalR2R));
|
||||
double defaultTarget = iValue;
|
||||
|
||||
//
|
||||
// Looping Back ...
|
||||
for (int i = 0; i < numberOfTargets; i++)
|
||||
{
|
||||
//
|
||||
// Detect Lowest Above Zone ...
|
||||
if (IsXBullish(dir))
|
||||
{
|
||||
//
|
||||
idx = GetLowestAbove(iValue, targetZones);
|
||||
has = IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
iValue = targetZones[idx].lower;
|
||||
}
|
||||
//
|
||||
// Detect Highest below Zone ...
|
||||
else if (IsXBearish(dir))
|
||||
{
|
||||
//
|
||||
idx = GetHighestBelow(iValue, targetZones);
|
||||
has = IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
iValue = targetZones[idx].upper;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Target Value ...
|
||||
has = NotEmptyZero(iValue) &&
|
||||
iValue != defaultTarget;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Init Target ...
|
||||
target.Clean();
|
||||
target.doRF = true;
|
||||
target.target = iValue;
|
||||
target.actingDistance = actingDistance;
|
||||
has = target.IsValid();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Add Target to Targets ...
|
||||
AddRef(
|
||||
target,
|
||||
targets //
|
||||
);
|
||||
}
|
||||
target.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Remove Nearest ...
|
||||
has = ignoreFirstTarget &&
|
||||
HasChild(targets);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
targets,
|
||||
0,
|
||||
1 //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
target.Clean();
|
||||
XClean(targetZones);
|
||||
}
|
||||
|
||||
//
|
||||
// TODO: Remove this ...
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
CArrayObj *zoneObjs;
|
||||
poiDrawer.DrawBoxes(
|
||||
supports,
|
||||
zoneObjs //
|
||||
);
|
||||
poiDrawer.DrawBoxes(
|
||||
resistances,
|
||||
zoneObjs //
|
||||
);
|
||||
poiDrawer.DrawBoxes(
|
||||
structure.fvgs,
|
||||
zoneObjs,
|
||||
false //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user