last works ...
This commit is contained in:
@@ -1067,26 +1067,69 @@ class XCXCAEATradeManager : public XCBaseAlert
|
||||
|
||||
//
|
||||
// Can Risk Free ...
|
||||
bool canRF = jTarget.target > 0 &&
|
||||
(isLong
|
||||
? jTarget.target > iPosition.entry
|
||||
: jTarget.target < iPosition.entry) &&
|
||||
(isLong
|
||||
? iPosition.price > targetDelta
|
||||
: iPosition.price < targetDelta);
|
||||
if (canRF)
|
||||
bool canRF =
|
||||
jTarget.doRF &&
|
||||
jTarget.target > 0 &&
|
||||
(isLong
|
||||
? jTarget.target > iPosition.entry
|
||||
: jTarget.target < iPosition.entry) &&
|
||||
(isLong
|
||||
? iPosition.price > targetDelta
|
||||
: iPosition.price < targetDelta);
|
||||
|
||||
//
|
||||
// Can Partial Close ...
|
||||
bool canPC =
|
||||
jTarget.volumeMultiplier > 0 &&
|
||||
jTarget.target > 0 &&
|
||||
(isLong
|
||||
? jTarget.target > iPosition.entry
|
||||
: jTarget.target < iPosition.entry) &&
|
||||
(isLong
|
||||
? iPosition.price > targetDelta
|
||||
: iPosition.price < targetDelta);
|
||||
bool canRFPC = canRF ||
|
||||
canPC;
|
||||
if (canRFPC)
|
||||
{
|
||||
//
|
||||
double tp = iPosition.tp;
|
||||
double sl = jTarget.target;
|
||||
string comment = "RF On Target ...";
|
||||
bool isModified = trader.Modify(
|
||||
iPosition.ticket,
|
||||
sl,
|
||||
tp,
|
||||
comment //
|
||||
);
|
||||
if (isModified)
|
||||
// Handle Risk Free ...
|
||||
bool isRFDone = false;
|
||||
if (canRF)
|
||||
{
|
||||
//
|
||||
double tp = iPosition.tp;
|
||||
double sl = jTarget.target;
|
||||
string comment = "RF On Target ...";
|
||||
isRFDone = trader.Modify(
|
||||
iPosition.ticket,
|
||||
sl,
|
||||
tp,
|
||||
comment //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Partail Close ...
|
||||
bool isPCDone = false;
|
||||
if (canPC)
|
||||
{
|
||||
//
|
||||
double volume = jTarget.volumeMultiplier * iPosition.volume;
|
||||
volume = NormalizeVolume(volume, iPosition.symbol);
|
||||
string comment = "RF On Target ...";
|
||||
isPCDone = trader.ClosePartial(
|
||||
iPosition.ticket,
|
||||
volume,
|
||||
comment //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Report Action ...
|
||||
bool isRFPCDone = isRFDone ||
|
||||
isPCDone;
|
||||
if (isRFPCDone)
|
||||
{
|
||||
//
|
||||
trades[idx].signal.appliedTargetIDX = j;
|
||||
@@ -1097,7 +1140,9 @@ class XCXCAEATradeManager : public XCBaseAlert
|
||||
ToString(iPosition.type) +
|
||||
" Position: " +
|
||||
ToString(iPosition.ticket) +
|
||||
" RF On Traget: " + ToString(jTarget.target) +
|
||||
(isRFDone ? "RF" : "") +
|
||||
(isPCDone ? "PC" : "") +
|
||||
" On Traget: " + ToString(jTarget.target) +
|
||||
" Successfully ...";
|
||||
HandleReportProtector(message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user