aidans this is a fundamental limitation of the MT4's implemented strategy tester. It can't be called a bug because it is very much an intentional aspect of the way MQ's coded the strategy tester to operate.
The fundamental limitation is this: because strategy tester can only access a single currency pair's market data the strategy tester cannot correctly compute the value of positions taken with cross-currency pairs (any currency pair which does not include the account's denomination) from a historical perspective.
If your account is USD denominated and you perform a backtest on AUDJPY then the conversion of P/L on positions opened/closed during the backtest will not use the historically accurate market price for the base and counter pairs (AUDUSD and USDJPY respectively) that are formed with the account's denomination (USD in this example).
(just as strategy tester does not account for historically accurate spreads)
There are no straight-forward ways to get around this limitation. You can correctly account for it in forward tests, because you can code your EA to correctly access and utilize the appropriate currency pair information, but you can't do this for backtesting.
aidans this is a fundamental limitation of the MT4's implemented strategy tester. It can't be called a bug because it is very much an intentional aspect of the way MQ's coded the strategy tester to operate.
Thanks 1005philip,
It seems that I must use perl or tcl scripts to process the statement report. so that I can match the backtest result to forward(real time) result.
USDJPY pair may also have this issue since P/L is in JPY pips -- (same 1,000,000 JPY did not equal to same size of USD over time)
The */USD pair does not have this issue.
It seems that I must use perl or tcl scripts to process the statement report. so that I can match the backtest result to forward(real time) result.
Yes, there are ways of forcing the accounting to be correct, as you intonated already.
My solution was to (1) export the historical price data for the relevant currency pairs to csv files, and (2) build a statement generator which manually parsed the cross-pair trades to adjust the actual P/L by the amount that reflects reality after looping thru the csv file (opened by the EA) to perform the proper adjustment for base value changes.
(it's not pretty nor is it practical, so I just stick with backtesting the USD currency pairs)
If you collect/log historical spread data as well as historical swap rates then you can apply the same method to account for these deficiencies in MT4's strategy tester as well.
(Not that this is practical either, after traveling down that rabbit hole I decided I was better off just going the opposite direction and developing strategies that are not sensitive to spread volatility and swap rates)
The */USD pair does not have this issue.
Neither do the USD/* pairs. It's only an issue when the currency pair in question does not have the account's denomination as either the base or the counter.
If your account is EUR denominated and you backtest on the GBPUSD pair you will encounter the exact same issue for the exact same reasons.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
From 2001.1.1 to 2009.12.1, I use 1% position size, the sl/tp is in AUDJPY pips, which means I can win or lose 1,000,000JPY
In this period, USDJPY is in 130 to 90 range, the same size of 1,000,000JPY shoud equal to different amount of USD. But backtest statement show another story(which is about the same amount of USD, 11,000USD)
Here is my Math: at 2001, 10M JPY equant to 1,000,000/130 USD, and in 2009, it should be 1,000,000/90 USD
Is this a feature or BUG? any work around to this issue?
I attached a sample backtest statement.