last works ...
This commit is contained in:
@@ -215,6 +215,10 @@ class XCXFIMABaseSignaller : public XCBaseSignaller
|
||||
result = fimaInputs.IsValid() &&
|
||||
fimaHelper != NULL &&
|
||||
poiDetector != NULL;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -358,13 +362,11 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
);
|
||||
|
||||
//
|
||||
// Handle Resting Signals ...
|
||||
has = HasDirection(iDir) &&
|
||||
iZone.IsValid();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Draw Zone ...
|
||||
|
||||
//
|
||||
// has = false;
|
||||
// iZone.Clean();
|
||||
@@ -372,6 +374,7 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
}
|
||||
|
||||
//
|
||||
// Prepare Signal ...
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
@@ -379,30 +382,73 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
isBearish = IsXBearish(iDir);
|
||||
|
||||
//
|
||||
// TODO: Provided SL ...
|
||||
// Provided SL ...
|
||||
double _point = GetPoints(iBar.symbol);
|
||||
double slAddition = 10 * _point;
|
||||
double atrAddition = GetAverageTrueRange(
|
||||
iZone.symbol,
|
||||
iZone.period,
|
||||
0 //
|
||||
);
|
||||
double slAddition =
|
||||
slAdditionDistance <= 0
|
||||
? 0
|
||||
: slAdditionDistance * _point;
|
||||
double slPrice =
|
||||
isBullish
|
||||
? iZone.lower - slAddition
|
||||
: iZone.upper + slAddition;
|
||||
|
||||
//
|
||||
// Prepare Founded Signal ...
|
||||
// Preparing Signal Targets ...
|
||||
XTarget iTarget;
|
||||
double spread = GetSpread(iZone.symbol);
|
||||
double entry = GetEntry(iZone.symbol, iZone.dir);
|
||||
double risk = MathAbs(entry - (isBullish ? iZone.lower : iZone.upper));
|
||||
|
||||
//
|
||||
// Handle Signal Targets ...
|
||||
// Handle Partial Close Position if Reached TP 1.5 ...
|
||||
iTarget.Clean();
|
||||
iTarget.actingDistance = 1;
|
||||
iTarget.volumeMultiplier = 0.5;
|
||||
iTarget.target = isBullish ? entry + (1.5 * risk) : entry - (1.5 * risk);
|
||||
iTarget.tpValue = isBullish ? entry + (2.5 * risk) : entry - (2.5 * risk);
|
||||
AddRef(iTarget, iTargets);
|
||||
|
||||
//
|
||||
// Handle Ignore Signal Targets if Forced ...
|
||||
if (ignoreTargets)
|
||||
{
|
||||
XClean(iTargets);
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Restrictions Based Signal Targets ...
|
||||
if (risk > 0 && HasRestrictions())
|
||||
{
|
||||
//
|
||||
// Here we Can Do Target Preparing if Signaller Restricted and
|
||||
// then ignore restrictions if required ...
|
||||
|
||||
//
|
||||
// Risk Free On Entry:
|
||||
iTarget.Clean();
|
||||
iTarget.doRF = true;
|
||||
iTarget.actingDistance = (5 * spread) / _point;
|
||||
iTarget.target = isBullish ? entry + (2 * spread) : entry - (2 * spread);
|
||||
AddRef(iTarget, iTargets);
|
||||
|
||||
//
|
||||
// Partial Close Position Half on TP 1 ...
|
||||
// Increase Rewards to TP 3 ...
|
||||
iTarget.Clean();
|
||||
iTarget.actingDistance = 1;
|
||||
iTarget.volumeMultiplier = 0.5;
|
||||
iTarget.target = isBullish ? entry + risk : entry - risk;
|
||||
iTarget.tpValue = isBullish ? entry + (3 * risk) : entry - (3 * risk);
|
||||
AddRef(iTarget, iTargets);
|
||||
|
||||
//
|
||||
// Reset Restrictions ...
|
||||
ResetRestrictions();
|
||||
}
|
||||
|
||||
//
|
||||
// Prepare Founded Signal ...
|
||||
has = PrepareSignal(
|
||||
iSignal,
|
||||
iDir,
|
||||
@@ -417,10 +463,14 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
// Notify On Signal Event ...
|
||||
NotifySignalEventListeners(iSignal);
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup ...
|
||||
iTarget.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
// Cleanup ...
|
||||
iBar.Clean();
|
||||
iZone.Clean();
|
||||
iSignal.Clean();
|
||||
|
||||
Reference in New Issue
Block a user