Defensive Asset Allocation

Hello. I’m trying to replicate the ETF system below in portfolio123. I’m a huge fan of the risk adjusted returns of this ETF trading system, but I need to change the ETF ticker universe depending on the momentum of the canary assets. When the canary assets have positive (negative) momentum, it will invest in risky (defensive) assets.

https://indexswingtrader.blogspot.com/2018/12/exploring-smart-leverage-daa-on-steroids.html?m=1

The first step is to see if the canary universe (VWO,BND) has positive momentum. I’m trying to set the VMO momentum (positive or negative) variable with a rule below, but it keeps giving me a right parenthesis error. Can anyone help me?

showVar(@Canary,(TotalReturn4W (0,GetSeries(“$VWO”)) * 12 + TotalReturn13W (0,GetSeries(“$VWO”)) * 4 + TotalReturn26W (0,GetSeries(“$VWO”)) *2 + TotalReturn (0,GetSeries(“$VWO”))))

The problem is that TotalReturn4W, TotalReturn13W, TotalReturn26W and TotalReturn aren’t functions. Try creating these custom formulas instead:

Name
Canary4W
Formula

100*(Close(0,GetSeries("VWO"))-Close(#month,GetSeries("VWO")))/Close(#month,GetSeries("VWO"))

Name
Canary13W
Formula

100*(Close(0,GetSeries("VWO"))-Close(#month*3,GetSeries("VWO")))/Close(#month*3,GetSeries("VWO"))

Name
Canary26W
Formula

100*(Close(0,GetSeries("VWO"))-Close(#month*6,GetSeries("VWO")))/Close(#month*6,GetSeries("VWO"))

Name
Canary52W
Formula

100*(Close(0,GetSeries("VWO"))-Close(#year,GetSeries("VWO")))/Close(#year,GetSeries("VWO"))

Name
Canary
Formula

$Canary4W*12+$Canary13W*4+$Canary26W*2+$Canary52W

Then you can use $Canary in your screen. (I am guessing that doing it straight in a rule is going to hit the character limit, by the way.) I’m guessing that you also might want to divide by four or something.

This should work;

showVar(@Canary,ROC(#Month,0,GetSeries("VWO"))*12+ROC(#Month*3,0,GetSeries("VWO"))*4+ROC(#Month*6,0,GetSeries("VWO"))*2+ROC(#Month*12,0,GetSeries("VWO")))

Walter

Hehe. I thought there was a way to do this easier. :slight_smile:

Thank you both for taking your time to help with these detailed solutions. The code is working for VWO. Am I correct that ROC does not take into account dividend (coupon) payments? The second component of the Canary universe is BND and it’s seems that I’ll need to measure total return to get an accurate signal.

As soon as it’s up and running, I’ll post the backtest for the base version without leverage. Ilya Kipness posted a leveraged version as well which I’ll try to replicate using 2x ETFs. However, the backtest may be limited due to the recent inception dates.

https://quantstrattrader.wordpress.com/author/ikfuntech/

Thanks, scrichely. I’m definitely interested interested in seeing the backtest once you have it up and running.

Hello, related to ROC not including dividends, have you figured out a way to include dividends?
I have the same problem.
Alberto

Good morning. No I haven’t. I’ll put together the system this weekend using price returns only, but expect it to pull out of the market very quickly when the BND canary turns negative artificially early.

Good evening. I was able to get the DAA system up and running. However, I still have two problems. Because the BND canary signal is not picking up the coupons, it shows negative momentum too often and moves to the safety assets (IEF,SHY in this case). The second problem comes in the ETF ranking stage where it is set to pick the Top 6 ETFs in the universe. When it’s “risk on” there are 12 ETFs, and the system correctly selects the top 6. However, in the “risk off” times, there are only 2 ETFs to choose from, so it equal weights SHY and IEF for those months. I think I can get an improved result by adding 10 more low risk bonds ETF to get an improved result during safety times. IEI,TLT,UST,SHV,LQD etc.

Risk Assets: SPY,QQQ,IWM,VGK,EWJ,VWO,GSG,GLD,VNQ,HYG, LQD,TLT
Safety Assets: SHY,IEF