AccountInfoDouble(ACCOUNT_BALANCE) Bug?

 

There's a problem with AccountInfoDouble(ACCOUNT_BALANCE) function. When I close a position inside OnTick() and then execute AccountInfoDouble(ACCOUNT_BALANCE), it returns the account balance before the position was closed.

It's easy to reproduce by calling the function immediately before and after closing a position inside OnTick().

If it's not a bug, how do I effectively get the current account balance after I've closed a position inside OnTick()?

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Account Properties - Documentation on MQL5
 

Sending order to close position doesn't mean closeing position. You should check that deal based on your order was appeared and executed.

Reason: