Download MetaTrader 5

how to get the actuall balance value

To add comments, please log in or register
Hassi
14
Hassi  

I want to calculate the contract amount regarding the actual balance of the depot.

Can anyone describe how I can read the balance ?

thanks in advance

Marco vd Heijden
Moderator
5333
Marco vd Heijden  
double balance=AccountBalance();
Hassi
14
Hassi  
Marco vd Heijden:

it isn't working - Error: 'AccountBalance' - function not defined

??

Marco vd Heijden
Moderator
5333
Marco vd Heijden  

well you didn't define the platform you are using so i assumed you were using MT4.

//Example:

void OnStart()
  {
//--- show all the information available from the function AccountInfoDouble()
   printf("ACCOUNT_BALANCE =  %G",AccountInfoDouble(ACCOUNT_BALANCE));
   printf("ACCOUNT_CREDIT =  %G",AccountInfoDouble(ACCOUNT_CREDIT));
   printf("ACCOUNT_PROFIT =  %G",AccountInfoDouble(ACCOUNT_PROFIT));
   printf("ACCOUNT_EQUITY =  %G",AccountInfoDouble(ACCOUNT_EQUITY));
   printf("ACCOUNT_MARGIN =  %G",AccountInfoDouble(ACCOUNT_MARGIN));
   printf("ACCOUNT_FREEMARGIN =  %G",AccountInfoDouble(ACCOUNT_FREEMARGIN));
   printf("ACCOUNT_MARGIN_LEVEL =  %G",AccountInfoDouble(ACCOUNT_MARGIN_LEVEL));
   printf("ACCOUNT_MARGIN_SO_CALL = %G",AccountInfoDouble(ACCOUNT_MARGIN_SO_CALL));
   printf("ACCOUNT_MARGIN_SO_SO = %G",AccountInfoDouble(ACCOUNT_MARGIN_SO_SO));
  }
Hassi
14
Hassi  

ok - I'm using MT5, but I'm going to read the function there - it should be the same ?!?!?

Hassi
14
Hassi  
Thanks a lot - I got it !!!
To add comments, please log in or register