how to calculate total amount deposited to the account?

 
hi , what function and id should i use to get total amount of deposits in the account?
 

You need to cycle trough all your OrdersHistory (in MT4) or History Deals (in MT5), checking their type.

When the type is correct (simply OrderType()>5 in MT4) or DEAL_TYPE_BALANCE (in MT5), you increase a variable in which you sum all deposits.

NOTE: Consider that brokers have different way of calculating swaps and commissions and some of them may figure as deposits/withdrawals, so make your tests.

 
 Login in to my trading account platform (eg, MetaTrader, CTrader, etc

I’m not able to contact my broker directly, but l can guide you through the process of withdrawing money from my trading,

Choose my with withdrawal method e.g bank transfer, credit card wallet. Please 🙏🏽🙏🏽🙏🏽
 
Fabio Cavalloni #:
DEAL_TYPE_BALANCE
it seems like mt5 treats withdrawal and deposits as the same type? am i correct? if so then how can it be working? i want calculate total profit percentage of the account so i need to exclude the deposits because there no initial balance value to calculate the percentage profit. is there any other way to do it? thank you
 
Payman #:
it seems like mt5 treats withdrawal and deposits as the same type? am i correct? if so then how can it be working? i want calculate total profit percentage of the account so i need to exclude the deposits because there no initial balance value to calculate the percentage profit. is there any other way to do it? thank you
Positive profit means deposit, negative profit means withdrawal 

There are several way to calculate the total profit percentage, it can be the sum of each individual profit % of your trades (considering the balance at the time they are entered), or can be the total profit you generated compared to your initial deposit, or other possibilities 

It all depends on what you want to calculate and how you want to express it
 
Payman:
hi , what function and id should i use to get total amount of deposits in the account?

you can run a function through your Account History and sum the trades that is != Magic Number if you are using EAs or OrderType() != OP_BUY||OP_SELL

//+------------------------------------------------------------------+
//|                                                                                   |
//+------------------------------------------------------------------+
double DepositSum()
  {
   double x=0;

   for(int i =  0; i < OrdersHistoryTotal(); i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true)
        {
         if(OrderSymbol() !=_Symbol && (OrderType() != OP_SELL || OrderType() != OP_BUY)  && OrderMagicNumber()!=Magic)
           {
            if(OrderProfit()>0)
              {
               x += OrderProfit();              
              }            
           }
        }
     }
   return x;
}