last works ...
This commit is contained in:
@@ -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 //
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user