How the balance is calculated?

 

I have a situation, when in strategy tester balance amount is not changed correctly by profit amount:



How this balance is calculated? In which way does MT4 calculate the balance data (probably taking more than 2 digits after comma)?

Regards
Arunas Ungulatis
 
arunasu wrote >>

I have a situation, when in strategy tester balance amount is not changed correctly by profit amount:


How this balance is calculated? In which way does MT4 calculate the balance data (probably taking more than 2 digits after comma)?

Regards
Arunas Ungulatis

Probably caused by the swap amount, which will accumulate whenever an open trade extends into a new day. I don't have MT4 available here, but from memory you can include swap in the history list by right-clicking on the table.

Paul

https://www.mql5.com/go?link=http://paulsfxrandomwalk.blogspot.com//

 
Also commission (if your broker has it)... Both can be seen by right-clicking the table and ticking them.
 
phampton:

Probably caused by the swap amount, which will accumulate whenever an open trade extends into a new day. I don't have MT4 available here, but from memory you can include swap in the history list by right-clicking on the table.

Paul

https://www.mql5.com/go?link=http://paulsfxrandomwalk.blogspot.com//

The EA generates 20 $ profit/loss. Additional amount in profit is swap. In current example 20 is loss, and 0.16 is swap.

Problem is 10138.72 - 20.16 = 10098.56 not 10098.55. There is 0.01 $ inadequacy.

 
gordon:
Also commission (if your broker has it)... Both can be seen by right-clicking the table and ticking them.

There is no additional commission

 
arunasu:

The EA generates 20 $ profit/loss. Additional amount in profit is swap. In current example 20 is loss, and 0.16 is swap.

Problem is 10138.72 - 20.16 = 10098.56 not 10098.55. There is 0.01 $ inadequacy.

What is the original swap (per 1 lot)? I imagine it's value is a bit greater than 1.65... That would mean that the profit column is truncated to 2 digits, but the actual calculation of balance is rounding the profit first...?

 
gordon:

What is the original swap (per 1 lot)? I imagine it's value is a bit greater than 1.65... That would mean that the profit column is truncated to 2 digits, but the actual calculation of balance is rounding the profit first...?

Interesting thing. With 1 lot is the same problem, but with 10 lots, amount is correct. Maybe I must calculate with 4 digits after comma.

1 lot



10 lots



I think, it is a bug of MT4. OLD BALANCE + PROFIT must always be equal NEW BALANCE.

 
arunasu:

Interesting thing. With 1 lot is the same problem, but with 10 lots, amount is correct. Maybe I must calculate with 4 digits after comma.

I think, it is a bug of MT4. OLD BALANCE + PROFIT must always be equal NEW BALANCE.

What's the account deposit currency? Whats the quote currency of the pair traded?

I suspect this has to do with tick value. Notice how swap is actually 1.606 (per 1 lot) and not 1.61...

 
gordon:

What's the account deposit currency? Whats the quote currency of the pair traded?

I suspect this has to do with tick value. Notice how swap is actually 1.606 (per 1 lot) and not 1.61...

Account deposit currency is USD. I test EUR/USD pair.

MarketInfo("EURUSD",MODE_TICKSIZE) = 0.0001

MarketInfo("EURUSD",MODE_TICKVALUE) = 10

 
arunasu:

Account deposit currency is USD. I test EUR/USD pair.

MarketInfo("EURUSD",MODE_TICKSIZE) = 0.0001

MarketInfo("EURUSD",MODE_TICKVALUE) = 10

Hmmm... I have no idea. Seems like a bug, but I am surprised I never noticed this happening.

 
arunasu:

The EA generates 20 $ profit/loss. Additional amount in profit is swap. In current example 20 is loss, and 0.16 is swap.

Problem is 10138.72 - 20.16 = 10098.56 not 10098.55. There is 0.01 $ inadequacy.

Isn't 10138 - 20.16 = 10118.56?


The discrepancy is on the s/l of a sell order. Without seeing the rest of the results i would guess that its due to the different time the spread is "paid" on a buy or sell orders.

Reason: