Try this: For open trades (not tested, but should work).
int total=OrdersTotal(); // number of open trades double OpenLots=0; double BuyTotal=0,SellTotal=0; for(int i=0; i<total; i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) { if(OrderType()==OP_BUY) { BuyTotal+=OrderLots(); // open Buy trades lots } if(OrderType()==OP_SELL) { SellTotal+=OrderLots(); // open Sell trades lots } OpenLots+=OrderLots(); // total open lots } }
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 is there anyone that knows the code of how to sum up all your trades and return the value of all your open orders position sizes and add them together....
for example if I had two open orders of 0.5 and 0.4 .... the EA would return that I have 0.9 in total positions ...
I would like it to return 3 values... one of the sells total, one of the buys total and then the complete total both buys and sells position sizes.
Thanks so much.