Spécifications
Hello
Set up
I have an account that has a floating loss(eg -1000)
with 1 buy trade and several sell trades (or 1 sell trade and several buy trades) with
the t otal buy lots being the same or similar to sell lots.
(note the above are not conditions ,the EA has to check . Is information of when I am likely to use it so the bottom make more sense)
What the EA would do when it loads
I want to specify a percentage of floating loss to be closed.
eg : if floating profit is -1000 and I specify 30. EA will close the necessary trades that would close trades with a loss of -300 and leave floating profit of -700 .
Conditions
1) The robot would have to close FIRST the trade that opened the FURTHEST away (does not matter if profit or loss) from current market price.
and proceed in that order when closing trades.
2) The same number of buy lots as well as sell lots have to close during this.
Hence every time some lots buy close ,the equivalent sell lots have to close
Notes:
-Some trades would close with partial lots.
-Some trades would close with profit/some with loss.
So the EA will have to calculate the correct lot sizes for both directions to achieve the 30% reduction(variable) in floating loss while closing the same number of lots for each.
Regards