Quote Originally Posted by peteonthenet View Post
Here is the code fuction which will return the total number of lots which are currently running in open trades :

Parameters: key is magic number, and type is the type of trades .


Code:
double gettotallot(int _key, int type)
{
double _lot=0;
 for(int k=OrdersTotal(); k>=0; k--)
                {  
                  if (OrderSelect(k,SELECT_BY_POS,MODE_TRADES)&& OrderSymbol()==Symbol()&& OrderMagicNumber()==_key && OrderType()==type)
                  _lot+=OrderLots();
                  } 
              return(_lot); 
 }
Awesome dude... I am learning a lot from your post.. Please carry on... And can you please also show us how to build an EA that will close all our opened order at once? Thanks and keep going