This commit is contained in:
2024-12-28 23:28:14 +03:30
parent c2cd52bf6b
commit 408422dcfc
20 changed files with 12042 additions and 3459 deletions
@@ -629,6 +629,16 @@ struct X121SMCTradeData
return signal.tp;
}
/**
* Get Model Target ...
*
* @return ( double )
*/
double Target()
{
return signal.target;
}
/**
* Get Position Spread on Open Time ...
*
@@ -2369,8 +2379,9 @@ class XC121SMCTradeHandler : public XCBaseAlert
//
// Check Deal Reason ...
bool isTP = deal.reason == DEAL_REASON_TP;
bool isSL = deal.reason == DEAL_REASON_SL;
bool isTP = deal.reason == DEAL_REASON_TP ||
(deal.reason == DEAL_REASON_SL && deal.profit > 0);
bool isSL = deal.reason == DEAL_REASON_SL && deal.profit < 0;
//
// Prepare Specified Message Based on Deal Reason ...
@@ -2494,7 +2505,7 @@ class XC121SMCTradeHandler : public XCBaseAlert
//
// Simulate TP/SL based on Closing Profit ...
bool isTP = position.profit > 0;
bool isSL = position.profit < 0;
bool isSL = position.profit <= 0;
//
if (isTP || isSL)
@@ -2890,7 +2901,8 @@ class XC121SMCTradeHandler : public XCBaseAlert
mTrader.GetPositions(
longs,
shorts,
signal.symbol //
signal.symbol,
signal.provider //
);
}
else
@@ -2899,7 +2911,8 @@ class XC121SMCTradeHandler : public XCBaseAlert
mTrader.GetPositions(
longs,
shorts,
NULL // All Symbols ...
NULL, // All Symbols ...
signal.provider //
);
}
@@ -3394,6 +3407,40 @@ class XC121SMCTradeHandler : public XCBaseAlert
}
}
}
//
// Handle RF On Target ...
double target = iData.Target();
bool canRF =
target > 0 &&
target > entry &&
(isLong
? iPosition.sl < target
: iPosition.sl > target) &&
iPosition.price > target + (10 * points);
if (canRF)
{
//
double sl = target;
double tp = iPosition.tp;
string comment = "RF On Target ...";
bool isModified = mTrader.Modify(
iData.ticket,
sl,
tp,
comment //
);
if (isModified)
{
//
string message = ToString(iData.Type()) +
" Position: " +
ToString(iData.ticket) +
" RF On Traget: " + ToString(target) +
" Successfully ...";
Alert(message);
}
}
}
}