Download MetaTrader 5
To add comments, please log in or register
Do you want to deposit to your account? Do this in any convenient way!
moonsboy
889
moonsboy 2015.01.22 09:17 

I don't want to use AccountBalance() as I want to calculate the balance of different EA on a same account.

I define accountBalance for the purpose. However how can I get a precise balance calculation after an order is closed considering commission and swap?

Is this correct?  

double accountBalance=1000.00;

void OnTick()
{
 ....
 ....
 accountBalance=accountBalance+OrderProfit()+OrderCommission()+OrderSwap();
 ...
 ...
}
whroeder1
13602
whroeder1 2015.01.22 17:06  
jollydragon: precise balance calculation after an order is closed
  1. The balance after all orders are closed is AccountBalance(). Having a different EA on the same account is irrelevant.
  2. The balance after the selected order, (if it is closed immediately,) would be AccountBalance() + OrderProfit() + OrderCommission() + OrderSwap().
  3. The balance after all orders are closed, (if it is closed immediately,) would be AccountBalance()  + sum of all orders, or more simply, just AccountEquity - MQL4 Documentation.
moonsboy
889
moonsboy 2015.01.23 02:53  
WHRoeder:
  1. The balance after the selected order, (if it is closed immediately,) would be AccountBalance() + OrderProfit() + OrderCommission() + OrderSwap().

Thank you! 

/
To add comments, please log in or register