Come on people ....
There are lots of programmers looking at these posts.
Please take 5 minutes and help out.
TS
tsheppard:
Come on people ....
There are lots of programmers looking at these posts.
Please take 5 minutes and help out.
TS
Should be something like this:
int LargestLoss() { int ticket=0; double LargestLoss=0; for(int k=OrdersTotal()-1;k>=0;k--) { if(OrderSelect(k,SELECT_BY_POS,MODE_TRADES)) { if(OrderProfit()<LargestLoss) { LargestLoss = OrderProfit(); ticket = OrderTicket(); } } } return(ticket); }
Notice that function returns the ticket number of the largest losing trade.
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
Hey Everyone,
I was wondering if someone can help me with some code for selecting the largest losing trade that is currently open, I've looked and looked and can't find anything.
Obviously we need to loop through open trades and search via OrderProfit() but I can't seem to get it right, or find the correct Math() function to select the largest negative value.
Thanks in advance so much for your help.
TS