Hi folks,
Regardless the type of your account, demo account or a real one; it's very important to have a set of functions to access this account information, for example the current account balance, the current account margin value and the current account total profit.
The account information functions are very useful for applying Money Management techniques by calculating the state of your account balance and margin etc.
Let's study these functions in details.
Syntax:
| double AccountBalance() |
Description:
The AccountBalance function returns the balance amount (how much money) of the current account. The calculation of the balance amount is the calculation of the starting capital + profit or - loss (of closed trades). The profit are loss are calculated only for the closed trades, so the floating profit/loss is not calculated within the balance!
Note: All of the Account Information function don't take parameters, see the examples!
Example:
| Print("Account balance = ", AccountBalance()); |
Syntax:
| double AccountCredit() |
Description:
The AccountCredit function returns the credit value of the current account
Example:
| Print("Account number ", AccountCredit()); |
Syntax:
| string AccountCompany() |
Description:
The AccountCompany function returns the brokerage company name you opened your current account with, the same as the name you find in the About dialog which you can open from Help menu.
Example:
| Print("Account company name ", AccountCompany()); |
Syntax:
| string AccountCurrency() |
Description:
The AccountCurrency function returns the name of the currency you used to open your account with the brokerage company, for example USD if you paid your account in US dollars.
Example:
| Print("account currency is ", AccountCurrency()); |
Syntax:
| double AccountEquity() |
Description:
The AccountEquity function returns the equity amount of the current account. The calculation of the balance equity is the calculation of the starting capital + profit or - losses (of all trades). The profit are loss are calculated for the opened and the closed trades.
Example:
| Print("Account equity = ",AccountEquity()); |