last works on XFima Strategy 2 Signalling ...
This commit is contained in:
@@ -577,7 +577,8 @@ class XCTarget : public XCBase
|
||||
|
||||
//
|
||||
// Do Risk Free if Provided ...
|
||||
if (target.doRF)
|
||||
if (result &&
|
||||
target.doRF)
|
||||
{
|
||||
//
|
||||
comment = "Taregt Manager do RF ...";
|
||||
@@ -590,13 +591,48 @@ class XCTarget : public XCBase
|
||||
|
||||
//
|
||||
// Handle Alert ...
|
||||
message = "Target Manager do RF " + ToXString(position.type) + " Position (" + ToXString(position.ticket) + ") on: " + ToXString(position.price);
|
||||
alert.SendAlert(message);
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
message = "Target Manager do RF " + ToXString(position.type) + " Position (" + ToXString(position.ticket) + ") on: " + ToXString(position.price);
|
||||
alert.SendAlert(message);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Do Risk Free on Entry if Provided ...
|
||||
if (result &&
|
||||
target.doRFOnEntry)
|
||||
{
|
||||
//
|
||||
comment = "Target Manager do RF on Entry ...";
|
||||
double actingDistance = position.GetPointsValue() * target.actingDistance;
|
||||
bool isLong = IsLong(position.type);
|
||||
double sl = position.entry + (isLong
|
||||
? actingDistance
|
||||
: (-1 * actingDistance) //
|
||||
);
|
||||
result = trader.Modify(
|
||||
position.ticket,
|
||||
sl, // SL ...
|
||||
position.tp, // TP ...
|
||||
comment //
|
||||
);
|
||||
|
||||
//
|
||||
// Handle Alert ...
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
message = "Target Manager do RF " + ToXString(position.type) + " Position (" + ToXString(position.ticket) + ") on Entry ...";
|
||||
alert.SendAlert(message);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Do Partial Close if Provided ...
|
||||
if (result && target.volumeMultiplier > 0)
|
||||
if (result &&
|
||||
target.volumeMultiplier > 0)
|
||||
{
|
||||
//
|
||||
double volume = NormalizeVolume((position.volume * target.volumeMultiplier), position.symbol);
|
||||
@@ -612,8 +648,47 @@ class XCTarget : public XCBase
|
||||
|
||||
//
|
||||
// Handle Alert ...
|
||||
message = "Target Manager do Partial Close " + ToXString(position.type) + " Position (" + ToXString(position.ticket) + ") by: " + ToXString(volume);
|
||||
alert.SendAlert(message);
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
message = "Target Manager do Partial Close " + ToXString(position.type) + " Position (" + ToXString(position.ticket) + ") by: " + ToXString(volume);
|
||||
alert.SendAlert(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Replace TP ...
|
||||
if (result &&
|
||||
target.tpValue > 0)
|
||||
{
|
||||
//
|
||||
// Validate TP Value ...
|
||||
bool isLong = IsLong(position.type);
|
||||
bool isValid = isLong
|
||||
? target.tpValue > position.price &&
|
||||
target.tpValue > position.tp
|
||||
: target.tpValue < position.price &&
|
||||
target.tpValue < position.tp;
|
||||
if (isValid)
|
||||
{
|
||||
//
|
||||
comment = "Target Manager Change TP ...";
|
||||
result = trader.Modify(
|
||||
position.ticket,
|
||||
position.sl, // SL ...
|
||||
target.tpValue, // TP ...
|
||||
comment //
|
||||
);
|
||||
|
||||
//
|
||||
// Handle Alert ...
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
message = "Target Manager Change TP of" + ToXString(position.type) + " Position (" + ToXString(position.ticket) + ") to: " + ToXString(target.tpValue) + " ...";
|
||||
alert.SendAlert(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user