last works ...

This commit is contained in:
2024-07-31 19:30:59 +03:30
parent cf1ecfaed5
commit 5d7c2c3388
10 changed files with 8947 additions and 15 deletions
+46 -7
View File
@@ -5640,21 +5640,60 @@ private:
}
//
bool FixRecoveredPositionTPSL(XPosition &osition)
bool FixRecoveredPositionTPSL(XPosition &position)
{
//
bool result = false;
//
// Try to Remove SL of Recovery Signals ...
if (osition.sl > 0 || osition.tp > 0)
result = position.IsValid();
if (!result)
{
return result;
}
//
double points = GetPoints(position.symbol);
// //
// // Try to Remove SL and TP of Recovery Signals ...
// if (position.sl > 0 || position.tp > 0)
// {
// //
// string comment = "EQM Recover Remove TP/SL";
// result = mTrader.Modify(
// position.ticket,
// 0,
// 0,
// comment //
// );
// }
//
// Try to Remove TP of Recovery Signals ...
if (position.tp > 0)
{
//
string comment = "EQM Recover Remove TP/SL";
double tp = 0;
bool isLong = IsLong(position.type);
double reward = MathAbs(position.tp - position.entry) / points;
if (reward <= mRecoveryTPPoint)
{
//
reward = (mRecoveryTPPoint * 2 * points);
tp =
isLong
? position.entry + reward
: position.entry - reward;
tp = NormalizePrice(tp, position.symbol);
}
//
string comment = "EQM Recover Fix TP/SL";
result = mTrader.Modify(
osition.ticket,
0,
0,
position.ticket,
position.sl,
tp,
comment //
);
}