Navigation: Backtest Engine Details > Testing Multi-Currency Strategies

RealTest can automatically model buying and selling shares of a stock which trades in a different currency from your account's base currency.

To illustrate how this works, here is a simple example:

The script imports MSFT and AUDUSD data series, and specifies the account's base currency as AUD.

It then makes one trade, contrived to show a combination of stock and currency gains:

(the above Trade List row was divided into two images for readability)

Here's the trade on a chart, which also shows USDAUD (1/AUDUSD) in the lower panel:

Looking more closely at this trade, here are all the things that happened:

The account's base currency is AUD, so the specified position size (value \$10,000) means \$10,000 AUD.

On entry day, that share quantity is calculated using that day's exchange rate, to buy the appropriate number of shares in USD to not exceed \$10,000 in AUD. In other words, \$10,000 AUD was converted to \$7,768 USD, which could buy 31 shares of MSFT.

While the position was held, MSFT paid a divided of \$0.56/share for holders of record as of 18-May-2021. This is credited to the trade profit as (31 shares) * (0.56 dividend per share) * (1.2837 USDAUD ratio on the record date) = \$22.28 AUD, as shown in the "Div" column of the trade list.

On exit day, the trade's net profit is calculated factoring in the difference in exchange rates between entry day and exit day. In this example, an additional \$694.01 was gained due to the favorable move in USDAUD while the Australian trader held a position in a US stock.

The key mechanics to be aware of in RealTest if you want to do this kind of testing are:

Your Import must include a symbol for the FX ratio between your account's base currency and the currency of each other country represented in your stock universe.

It does not matter in which direction the ratio is expressed (AUDUSD vs. USDAUD). RealTest inverts as needed based on the nomenclature.

If your data source is not Norgate, you might need to use the alias mechanism in your IncludeList to convert, for example, Yahoo's "JPY=X" symbol to "USDJPY". RealTest requires that the FX symbols are in this six-letter format for this feature to work.

RealTest similarly requires three-letter currency symbols in the metadata of each stock in order to know whether and how to convert it. Use a SymInfo File if necessary to provide these.

With Norgate data, the FX symbols are all in the correct format and the currency metadata is provided automatically.

Add a Currency statement to your Settings, to tell RealTest that you want it to model currency conversion, and what your account's base currency is. No conversions are done if there is no Currency statement.

To observe the impact of currency conversion to your test statistics, the following data are available:

T.FxIn - the exchange rate on the date of trade entry (can be optionally included in the trade list, as in the above example)

T.FxOut - ditto for the trade exit date

T.NetFx - the net dollar impact of FX change to the trade

S.NetFx - the sum of T.NetFx for all trades exited that day of the test (can optionally be included in the results summary or graphs)