int cnw; double maxLoss=0; int maxLossTicket=-1; for(cnw=0; cnw<OrdersTotal(); cnw++) { if(OrderSelect(cnw,SELECT_BY_POS) && OrderMagicNumber()==MagicNumber && OrderSymbol()==Symbol()) { if(OrderProfit()<maxLoss) // Loss is < 0 { maxLoss=OrderProfit(); maxLossTicket=OrderTicket(); } } } if(maxLossTicket!=-1) { //... Comment("groesster Verlust: "+maxLoss); }
angevoyageur:
ok, that seems to work. maybe I was thinking way to complicated ......
thanks!
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
I want to identify which of the open trades has the biggest open loss.
And then I want to close it or a part of it.
I got the part with the biggest open loss, but I do not know how to add the ticketnumber to that information in the array.
so I could select this one trade after
I guess working with multidimensional arrays would do it, but I do not know how.
This is what I got: