Download MetaTrader 5

AccountBalance() and array

To add comments, please log in or register
dolar
22
dolar  
Hello Guys,

Do you know any solution which allows save to an array:
- an account balance (as balance1) before trade and
- an account balance (as balance2) after trade?

How to check AccountBalance() every time when OrdersHistoryTotal() changes?

Thanks.
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI  
Store the value using Global Variables. Retrieve it when needed.
Alain Verleyen
Moderator
32394
Alain Verleyen  
dolar:
Hello Guys,

Do you know any solution which allows save to an array:
- an account balance (as balance1) before trade and
- an account balance (as balance2) after trade?

How to check AccountBalance() every time when OrdersHistoryTotal() changes?

Thanks.
   static int previousHistoryTotal=0;
   
   if(OrdersHistoryTotal()!=previousHistoryTotal)
   {
      // Check your account balance
      ...
      previousHistoryTotal=OrdersHistoryTotal();
   }
qjol
3243
qjol  
using OrdersHistoryTotal can be a problem unless you make sure you selected to show all history
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI  
Its got even worst when there are brokers that truncate the order history.
To add comments, please log in or register