This commit is contained in:
2024-06-08 19:05:21 +03:30
parent 96bbe92630
commit 52e4d1316d
+23
View File
@@ -49,6 +49,7 @@ struct XProtectedPosition
// Working Variables ... // Working Variables ...
double recoveryZoneStep; // Used Recovery Zone Step double recoveryZoneStep; // Used Recovery Zone Step
int lastRecoveryLevel; // Last Recovery Level int lastRecoveryLevel; // Last Recovery Level
datetime lastRecoveryTime; // Last Recovery Time
double lastVolume; // Last Recovery Volume double lastVolume; // Last Recovery Volume
ulong tickets[]; // Recovery Trades Tickets ulong tickets[]; // Recovery Trades Tickets
@@ -124,6 +125,7 @@ struct XProtectedPosition
openAt = NULL; openAt = NULL;
lastRecoveryLevel = 0; lastRecoveryLevel = 0;
lastVolume = 0; lastVolume = 0;
lastRecoveryTime = NULL;
Clean(tickets); Clean(tickets);
} }
@@ -335,6 +337,26 @@ struct XProtectedPosition
return result; return result;
} }
//
// Check Last Recovery Time ...
int age =
!IsValid(this.lastRecoveryTime)
? -1
: iBarShift(
this.symbol,
this.period,
this.lastRecoveryTime,
false //
);
result =
age == -1
? true
: age >= 5;
if (!result)
{
return result;
}
// //
// Now we have to Prepare Signal based on Recovery Mode ... // Now we have to Prepare Signal based on Recovery Mode ...
@@ -909,6 +931,7 @@ protected:
// Do What we Want ... // Do What we Want ...
item.lastRecoveryLevel++; item.lastRecoveryLevel++;
item.lastVolume = signal.volume; item.lastVolume = signal.volume;
item.lastRecoveryTime = TimeCurrent();
Add( Add(
signal.positionId, signal.positionId,
item.tickets // item.tickets //