AccountBalance() Not Changed after Trade - page 2

 
ChrisSouthwood:

We are probably wearing out this thread now but still find it odd that I cant access information to determine the amount of cash that is in the trading account until all positions are closed.

AccountEquity() is the amount of cash "in the trading account", i.e. what you will be left with if you close all your positions right now (with the slight exception that some brokers may deduct a portion of commission when closing a position).

 

ChrisSouthwood:

Bit like my bank telling me that having spent all my cash on a purchase I still have that original balance in my account. I understand equity, that is not what I want. 

If you have $1,000,000 and you buy some Berkshire Hathaway shares (shares, not CFDs), or a Picasso etching, or a house, then you have an asset with a resale value and a reduced amount of money in your bank account. For example, you now have $500,000 in your bank account plus an asset with an immediate resale value of $495,000. You have net wealth, or "equity", of $995,000 - your original $1million plus the value of the asset minus transaction costs/commission/taxes. But that's different to a leveraged fx transaction.

If you go long 1 lot USD/JPY then you are buying $100,000 USD and selling $100,000-worth of JPY. But you aren't actually spending $100,000 in the same sense as buying the Berkshire Hathaway shares or the house, because this is a speculative leveraged transaction, on margin. If your broker offers 50:1 leverage then you're actually committing $2000 to this transaction. You get back the $2000, plus the profit or loss on the trade, when the position is closed - either closed at your discretion, or forcibly closed by the broker because of something like a margin call.

It's a commonplace of this sort of trading that the $2000 is not deducted from the account balance when you open a position and then re-credited to it when you close a position, because what you are doing is not directly comparable to buying and then selling an asset such as raw unleveraged equities, or a Picasso, or a house. You are not spending the $2000 on an asset.

If you really want to think of it in these terms, then the closest match against the money "in the trading account" is AccountFreeMargin(). For example, you start with $1,000,000 and you go long 1 log USD/JPY at 50:1 leverage, i.e. a margin requirement of $2000. That position is immediately in loss by the cost of the spread, e.g. in loss by $10. AccountFreeMargin() will fall from $1,000,000 to $997,990. AccountEquity() will be $999,990, reflecting the fact that you get back the $2000 when the position is closed.

 
ChrisSouthwood:

We are probably wearing out this thread now but still find it odd that I cant access information to determine the amount of cash that is in the trading account until all positions are closed.

Bit like my bank telling me that having spent all my cash on a purchase I still have that original balance in my account. I understand equity, that is not what I want.

AccountBalance()  as described in MQL4 docs states "Balance value of the current account (the amount of money on the account)". It does not.

When trading live you have ' Account History' that shows the cash in the account and profit/loss. By clicking 'Trade' we can see the quantity and value of open trades. That information is what I am looking for to use in my code.

Chris

When you place a trade, you effectively borrow the full amount to fund the trade, so your balance is unaffected. When the trade is closed profit/loss including expenses is added/deducted to the balance
Reason: