AccountBalance() and array

 
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.
 
Store the value using Global Variables. Retrieve it when needed.
 
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();
   }
 
using OrdersHistoryTotal can be a problem unless you make sure you selected to show all history
 
Its got even worst when there are brokers that truncate the order history.
Reason: