Tâche terminée
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
Spécifications
The EA will
be a trade manager. It won't open positions by itself,
but only manage trades which are
opened manually or by another EA.
If a long position is opened the
EA sets Stop Loss and Take Profit marks
according to the input
parameters (pip-distance from entry price).
BUT these levels are no real SL
or TP orders, but only price levels
which require further actions
when hit.
If TP is hit, the trade will be
closed normally.
If SL is hit, the ALR (automatic
loss recovery) algorithm starts.
ALR
example input parameters:
SL: 500
TP: 1500
FixedProfit: 100
MaxTurns: 10
The first trade is opened
manually or by another EA. For example 1 Lot long at 1,29500
SL level is 1,29000, TP
level is 1,31000.
If SL is hit, the orignal
position remains OPEN, but the EA opens an additional position, for example 1.4
Lot short at 1,29000. SL of the 2nd trade is 1,29500, TP of the 2nd trade is
1,27500.
If then TP of the 2nd trade
(1,27500) is hit, all positions are closed immediately.
That would be 1 Lot with a loss
of 2000pips and 1,4 Lot with a profit of 1500pips --> 100 Pips profit.
BUT: If SL of the 2nd trade is
hit, another position is opened, for example 0,93 Lot long at 1,29500.
SL of the 3rd position would be
1,29000 and TP of the 3rd positon would be 1,31000.
If then TP (1,31000) is hit, all
positions are closed immediately at 1,31000.
But, if 1,29000 is hit, the game
starts all over again.
For better understanding, look
at the picture.
The EA should calculate the Lot
Size of the next trade which is necessary to
get a certain amount of pips
profit. This amount is an input parameter
(can also be zero if you just
want the get out of a trade break even).
After 10 turns (also an input
parameter) no more new positions should be opened.
But if either TP or SL is then
hit all position should be closed immediately.
That's how calculations look like: