Why my calculation does not match metatrader 4 backtest loss?

124 Views Asked by At

I am writing and expert advisor and ran a test. And I cannot understand, and find info why loss amount is not matching my calculations. To do backtesting I should get correct results.

enter image description here

So in the image we see there was 0.79 lot position opened at 109.87 closed at 109.939.

enter image description here

Here is the position size calculator showing swap. enter image description here

But when backtesting I am getting even lower swap. Maybe calculator indicator is showing wrong. With lower swap the gap between expected loss and actual loss is even bigger.

enter image description here

So daily swap eats 6.15 usd. Account is in usd. From jan 22 to feb 6 it has been 17 swaps. Commision as you will see below in log is 3.16.

So my math is 6.15*17+52.5+3.16=160.21

but position loss is 175.48.

I also have printed swap each day:

2020.11.30 20:55:10.728 2020.02.06 00:00:00 adx USDJPY,H1: swap: -98.7114401
2020.11.30 20:55:10.728 2020.02.05 00:00:00 adx USDJPY,H1: swap: -81.29177420000001
2020.11.30 20:55:10.727 2020.02.04 00:00:00 adx USDJPY,H1: swap: -75.48521890000001
2020.11.30 20:55:10.727 2020.02.03 00:00:00 adx USDJPY,H1: swap: -69.67866360000001
2020.11.30 20:55:10.727 2020.01.31 00:00:00 adx USDJPY,H1: swap: -63.87210830000001
2020.11.30 20:55:10.721 2020.01.30 00:00:00 adx USDJPY,H1: swap: -58.06555300000001
2020.11.30 20:55:10.721 2020.01.29 00:00:00 adx USDJPY,H1: swap: -40.6458871
2020.11.30 20:55:10.721 2020.01.28 00:00:00 adx USDJPY,H1: swap: -34.8393318
2020.11.30 20:55:10.720 2020.01.27 00:00:00 adx USDJPY,H1: swap: -29.0327765
2020.11.30 20:55:10.720 2020.01.24 00:00:00 adx USDJPY,H1: swap: -23.2262212
2020.11.30 20:55:10.720 2020.01.23 00:00:00 adx USDJPY,H1: swap: -17.41966590000001
2020.11.30 20:55:10.719 2020.01.22 00:00:00 adx USDJPY,H1: commission -3.16

and it shows about 5.8 for one day. Which would make even bigger gap if I would use it for my calculation.

0

There are 0 best solutions below