How to rank country ETFs by it's currency strength?

The topic says it all.

Country ETFs include
CNY FXA FXC FXS FXY FXF FXS FXB GBB BZF FXC ICN UUP EWG
the corresponding currency ETFs are:
EWA EWA EWC EWD EWJ EWL EWS EWU EWU EWZ FXI INP MDY FXE

The challenge is to create a ranking system that ranks country ETFs based on the strength of their currencies. This is a proven method to rank the equity markets of countries. The most straightforward way to do this is to create a bunch of Eval()'s. Something like:
Eval(Ticker(“CNY”), Close(0, GetSeries(“EWA”)) / Close(252, GetSeries(“EWA”), 0) + Eval(…) …
But this is not an optimal solution. There are only about 256 characters allowed per node. Is there a better way?

Thanks.

Chipper - you have the country and currency ETFs backwards. Also they don’t “correspond”. If you get them to correspond 1:1 then I might be able to help you. As an example, you have EWA down twice, and FXC.
Steve

Create 10 strategies and combine them in a book?

Thanks Steve,

Equities:
EWA EWZ EWC FXI EWG INP EWJ EWS EWD EWL EWU MDY

Currencies:
FXA BZF FXC CNY FXE ICN FXY FXSG FXS FXF FXB UUP

After giving it some more thought I created a custom variable called $CurrencySeries containing the following formula:
Eval(Ticker(“EWA”), 26317, 0) + Eval(Ticker(“EWZ”), 28258, 0) + Eval(Ticker(“EWC”), 26314, 0) + Eval(Ticker(“FXI”), 33192, 0) + Eval(Ticker(“EWG”), 26316, 0) + Eval(Ticker(“INP”), 28257, 0) + Eval(Ticker(“EWJ”), 25041, 0) + Eval(Ticker(“EWS”), 43887, 0) + Eval(Ticker(“EWD”), 24829, 0) + Eval(Ticker(“EWL”), 26313, 0) + Eval(Ticker(“EWU”), 26320, 0) + Eval(Ticker(“MDY”), 25053, 0)

Close(0, $CurrencySeries)
should then retrieve the price of the corresponding currency.
I hope it’s correct; it’s kind of hard to debug.

Chipper - Interesting idea. I tried this exactly as in your post but I got the following error:

Invalid series specified in Close: $CurrencySeries

I’m not sure if one of your IDs are invalid or it doesn’t like the custom formula. Have you gotten this to work? Do you know if the Ticker ID remains the same forever?

Steve

Steve,

It works for me but only after the tickers began trading. I get the error when trying to backtest it in 1999.

[quote]
Do you know if the Ticker ID remains the same forever?
[/quote]That’s a very good question. Perhaps someone at P123 can answer it.

Do you have a different approach in mind?

Chipper - I’m not proud, but I got it to work. I tried everything but finally had to resort to brute force.

https://www.portfolio123.com/app/ranking-system/259972
https://www.portfolio123.com/app/screen/summary/134140?st=1&mt=12

Custom Formulas
$A Ticker(“EWA”)
$AA Close(0,GetSeries(“FXA”))/ Close(251,GetSeries(“FXA”))
$B Ticker(“EWZ”)
$BB Close(0,GetSeries(“BZF”))/Close(251,GetSeries(“BZF”))
$C Ticker(“EWC”)
$CC Close(0,GetSeries(“FXC”))/Close(251,GetSeries(“FXC”))
$D Ticker(“FXI”)
$DD Close(0,GetSeries(“CNY”))/Close(251,GetSeries(“CNY”))
$E Ticker(“EWG”)
$EE Close(0,GetSeries(“FXE”))/Close(251,GetSeries(“FXE”))
$F Ticker(“INP”)
$FF Close(0,GetSeries(“ICN”))/Close(251,GetSeries(“ICN”))
$G Ticker(“EWJ”)
$GG Close(0,GetSeries(“FXY”))/Close(251,GetSeries(“FXY”))
$H Ticker(“EWS”)
$HH Close(0,GetSeries(“FXSG”))/Close(251,GetSeries(“FXSG”))
$I Ticker(“EWD”)
$II Close(0,GetSeries(“FXS”))/Close(251,GetSeries(“FXS”))
$J Ticker(“EWL”)
$JJ Close(0,GetSeries(“FXF”))/Close(251,GetSeries(“FXF”))
$K Ticker(“EWU”)
$KK Close(0,GetSeries(“FXB”))/Close(251,GetSeries(“FXB”))
$L Ticker(“MDY”)
$LL Close(0,GetSeries(“UUP”))/Close(251,GetSeries(“UUP”))

I’m going to take this down after today so anyone who wants this should copy it now.

Steve

This rank performance graph is a 5 year / 4 week rebalance.
Steve


currency.gif

Another great use case for having a summation rank node actually sum the raw values instead of ranked values. If the summation node would sum the raw values, then you could just make 12 nodes with Eval(Ticker(“CountryETF”), Close(0,GetSeries(“CurrencyETF”))/ Close(251,GetSeries(“CurrencyETF”)), 0)…

Steve, your rank buckets are beautiful! I was almost ready to give up because it wasn’t working for me, but thanks to your inspiration I developed the following. (Being lazy and not wanting to put in all those custom formulas, I tried the following custom formula to replace $CurrencySeries above): Ticker("EWA")*GetSeries("FXA") + Ticker("EWZ")*GetSeries("BZF") + Ticker("EWC")*GetSeries("FXC") + Ticker("FXI")*GetSeries("CNY") + Ticker("EWG")*GetSeries("FXE") + Ticker("INP")*GetSeries("ICN") + Ticker("EWJ")*GetSeries("FXY") + Ticker("EWS")*GetSeries("FXSG") + Ticker("EWD")*GetSeries("FXS") + Ticker("EWL")*GetSeries("FXF") + Ticker("EWU")*GetSeries("FXB") + Ticker("MDY")*GetSeries("UUP")
This fixes the problem with hardwired series IDs, although it is dependent on takig advantage of the fact that in P123 logic 0 is True and 1 is False. This could change sometime in the future, but by then perhaps they will also create a easier way to do this.

My ranking system is simply:

Close(0, $CurrencySeries) / Close(251, $CurrencySeries)

Thanks!

That’s awesome Chipper. I’m surprised your formula works when the other one didn’t.
Steve

Impressive stuff, guys. Thanks for sharing.

You’re welcome Alan. I find that the quality of my work noticeably improves when I share it because of the feedback and because it forces me to think a little more.

BTW, the equity curve is not nearly as beautiful as the ranking system buckets. I suppose it’s because the major world stock markets are correlated with each other and rotating from country to country is not enough during volatile times. I wonder if there is a way to hedge this volatility.

Chaim and Steve,

I may be misinterpreting what you are trying to do as I do not usually use custom formulas but are you trying to create a system that buys a stocks index based on depreciation of its currency? If so shouldn’t you also consider the velocity and duration of the currency move (a short term 25% currency move will have a much larger impact than a 1% move over a year)?

"create a ranking system that ranks country ETFs based on the strength of their currencies. This is a proven method to rank the equity markets of countries. " Chaim, do you have a reference for this? My prior data search on this topic has shown no more than a short term correlation.

Thanks for bringing up this topic

Scott

[quote]
Chaim and Steve,

I may be misinterpreting what you are trying to do as I do not usually use custom formulas but are you trying to create a system that buys a stocks index based on depreciation of its currency? If so shouldn’t you also consider the velocity and duration of the currency move (a short term 25% currency move will have a much larger impact than a 1% move over a year)?
[/quote]Hi Scott,

Thanks for your interest. I tried other lookback periods and one year gave the best result for me.

I don’t always remember my sources. I have seen the link between a weak currency and a stronger stock market in at least two different sources with backtests going back about a century. But I tried to find the article that I saw but came up empty. I read dozens of articles (and a few booklets) a day related to investing. The chart looked very similar to Steve’s. Perhaps someone else remembers it? Was it in one of the Credit Suisse reports?

I became interested in developing this system after seeing the link between quantitative easing, currency depreciation and the stock market. First the US Fed eased and the US stock market went up. Then Japan eased and it’s market went up while it’s currency fell. Next the EU eased and we see the Euro weakening and the European stock markets rising. It seems a bit too correlated and predictable to be coincidental. I don’t [yet] fully understand the mechanism linking weakening currencies to rising markets. Perhaps a weakening currency is simply a sign of QE and it is QE that pushes up the market?

While this system works, I don’t [yet] know how to use this system effectively. It is not an effective hedge to US equity because world economies are interlinked. I’ll take my US stock picking models over global equity ETFs any day of the week until I have millions to invest. Perhaps once we get global data on P123 then we can use this type of system to choose which country to invest in.

What do you mean by “short term”? I made a simulation that mainly uses currencies to predict country outperformance and it beats the SPY easily.

Hi Chaim,

The window for this sim is during a short period of time (this is a limitation of the currency data set) that as you mentioned in your post has had currency moves that have been initiated by quantitative easing. Currencies without quantitative easing can remain range bound for long periods of time (years). If currencies are range bound and/or have smaller movements in the future (assuming that quantitative easing ends) then the currencies will have less of an impact of the stock performance of the respective counties then what we have seen in the last few years. As such a system based on buying a countries index based on its currency direction may be less predictive in the future than it has been in the past. However I do not presume to be a currency expert so if anyone has a reference indicating a strong lead lag type relationship between currencies and country performance that extends to the period prior to quantitative easing then please post the reference.

Scott

Hi Scott,

For a good start on understanding why QE is being used in the U.S., Japan and now Europe you may want to read Ray Dalio’s classic piece on debt here.

Chaim

Chaim,

Thanks for the link but I am specifically interested in any papers showing a statistically significant lead lag type relationship between currencies and country performance that extends to the period prior to quantitative easing (I have not been able to find one).

Scott

Scott, see page 14 of this link for a 38 year backtest of this strategy within emerging markets.

Chaim