Strategy tester: question regarding the applied exchange rate for account currency/quote currency

A few sentences in advance before I come to my question: unlike in live trading, I usually don’t give much attention to the “official” balance that I get in the strategy tester via AccountInfoDouble(ACCOUNT_BALANCE).

The reason behind this is that - with a low spread ECN broker - I need to emulate commissions and swap in order to get more realistic results (and also for future position sizing the remaining balance/equity AFTER the sum of all commissions is much more interesting than a phantasy number as result of almost “free” trades). These commissions are calculated in USD, but my account currency is EUR. Apart from that, with most currency pairs that I trade the ‘quote’ currency or ‘profit’ currency also often is USD or JPY, so in order to keep my “real” net balance updated, I always need to convert from profit currency to account currency myself via substraction of the execution prices of exit and entry, multiplying with the contract size (lots*size of the standard lot) and dividing by the current exchange rate of that day, so e.g. EURUSD or EURJPY. In order to achieve this, I use SymbolInfoDouble for the real time exchange rate. All this only matters in the strategy tester, cause in real trading balance is balance and I don’t need to emulate commissions cause their automatically withdrawn.

And here comes the interesting thing with the strategy tester: if I ignored commissions and swap, I should get the same net result for an individual trade as the difference between the current “official” balance and the last balance before this trade. But the result is often different by several percent. I can only imagine that the problem is a wrong exchange rate used by the strategy tester. If the testing periods is several years in the past, the exchange rate for profit currency–>account currency could have been much different at that time than today.

So here is the question: does anybody know if the strategy tester simply uses the exchange rate of today, even if the test period is several years in the past? This would lead to significantly wrong results! I mean: if the tester did otherwise and actually used up-to-date rates, I should see the download of all the historical data e.g. for EURUSD (=in addition to the rates of the traded symbol on the chart) in the journal when the test starts - but I don’t as long as these data are not requested for my own emulations.

Any ideas?

As far as i know, exchange rate is correctly used, so a deal a year ago would use exchange rate from a year ago.

I do remember there was some issues with some version of MT5 where there was a bug using deposit other then USD.

Swap however is calculated historically with the swap rates of today.

There are many issues with the tester as it is (unrealistic positive slippage, unrealistic hits of tp/sl/pending orders). All this can be solved with code, however my advice, use tester to evaluate the strategy and debug your code, not for profit.

Thanks htwyford1p,

As you see, I actually do resolve some issues with code; the official numbers that the tester spits out are very unrealistic; you have to calculate everythin internally yourself (=swap, commissions, real balance and equity) and anything else but real tick data is completly garbage. But I get your point, nobody should expect that the tester tells you anything about real results.

Still I can’t believe that the tester uses historical exchange rates (for non USD deposits) as long as there’s nothing like that shown on the log. For myself the question was just out of curiosity. Because of my own emulations it has no consequence for the trading decisions in testing.

I tested with Deposit in EUR trading GBPJPY MT5 build 2085:

The data to calculate the exchange rates are loaded, so in theory it should be used. I did not check if it actually did however.

You should better use SymbolInfoTick().

And here comes the interesting thing with the strategy tester: if I ignored commissions and swap, I should get the same net result for an individual trade as the difference between the current “official” balance and the last balance before this trade. But the result is often different by several percent. I can only imagine that the problem is a wrong exchange rate used by the strategy tester. If the testing periods is several years in the past, the exchange rate for profit currency–>account currency could have been much different at that time than today.

Can you show an example of your calculation on a trade with all needed data to check ?

So here is the question: does anybody know if the strategy tester simply uses the exchange rate of today, even if the test period is several years in the past? This would lead to significantly wrong results! I mean: if the tester did otherwise and actually used up-to-date rates, I should see the download of all the historical data e.g. for EURUSD (=in addition to the rates of the traded symbol on the chart) in the journal when the test starts - but I don’t as long as these data are not requested for my own emulations.

Any ideas?

I do agree with Enrique, historical prices are used to calculate the conversion, and I checked it.

I got a performance hungry backtest running right now that will probably take the whole weekend; I will show you an example after that.