Simple Rotational System (FAA)

Questions and discussions on Time Series Analysis
ac_1
Posts: 495
Joined: Thu Apr 15, 2010 6:30 am

Simple Rotational System (FAA)

Unread post by ac_1 »

Hi,

I am attempting the following METHOD in RATS,
Keller and Van Putten (2012) Generalized Momentum and Flexible Asset Allocation (FAA), An Heuristic Approach
http://papers.ssrn.com/sol3/papers.cfm? ... id=2193735

but with different & latest ETF data.

I have read in DAILY PRICES from Norgate Premium on 7 ETF's (open & close's) as follows:

Code: Select all

open data " path to excel 1993 worksheet"
calendar(d) 2010:01:04
allocate 2017:08:18
data(format=xls,org=columns) 2010:01:04 2017:08:18 Index	$
EEM_O EEM_C IEF_O IEF_C IEV_O IEV_C MDY_O MDY_C QQQ_O QQQ_C TLT_O TLT_C XLV_O XLV_C
I have 1921 obs with 69 NA's = a total of 1990 "values".

To deal with the NA's I have e.g.

Code: Select all

set EEM_O  = %if(%valid(EEM_O), EEM_O, EEM_O{1})
Now I have 1990 obs.

Please advise on how I calculate the following:

Rolling
M: 4 months momentum (rate of change) on MONTHLY returns, then rank (highest is best)
V: 4 months standard deviation (volatility) on DAILY returns, then rank (lowest is best)
C: 4 month AVERAGE correlation across the ETF's on DAILY returns, then rank (lowest is best)

(Presumably for MONTHLY momentum I would use MONTHLY end-points).

Thereafter, select top 3 assets based on final
MVC RANKING = ( (100% MOMENTUM) + (50% VOLATILITY) + (50% CORRELATION) ).
Low ranking numbers are good for investment (go LONG TOP 3 RANKED "forecasts")
Now, if from those RANKED TOP 3, replace any asset with M <= 0 for cash, as proxy for cash returns use IEF, i.e. any ETF with M <= 0 will be replaced by IEF.
Rebalance MONTHLY, i.e. go LONG the TOP 3 "forecasts".

many thanks,
Amarjit
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Simple Rotational System (FAA)

Unread post by TomDoan »

I'm not completely sure what your original calculations are. Do you want monthly values from four month windows of daily data? If so, the following will generate rolling four month samples for 100 months starting 4 full months into the data set. (You would have to replace 100 with whatever is appropriate). This uses the fact that you can "overindex" the months and days in the calendar arithmetic (that, is, RATS recognizes 2000:13:1 as meaning 2001:1:1). The easiest way to find the last usable period in a month is to get the first usable period in the next month (year:(month+1):1) and subtract 1 which is what the monthends calculation is doing.

cal(d) 2000:1:1
dec vect[int] monthends(100)
ewise monthends(i)=(%year(1):(%month(1)+3+i):1)-1
dofor time = monthends
compute rstart=%year(time):(%month(time)-3):1
compute rend=time
disp %datelabel(rstart) %datelabel(rend)
end dofor time

Do your calculations over the rstart to rend range to get a four month window.
ac_1
Posts: 495
Joined: Thu Apr 15, 2010 6:30 am

Re: Simple Rotational System (FAA)

Unread post by ac_1 »

Hi Tom,

Thanks for the reply.
Do you want monthly values from four month windows of daily data?
Yes I think so.
The calculations I have thus far are "signals or forecasts" for investing (or rebalancing) on a MONTHLY basis generated from DAILY data.

However, I would like the strategy to be updated on a DAILY basis.


So I have the following:

calculated returns, e.g.

Code: Select all

set rEEM_O = (EEM_O - EEM_O{1}) / EEM_O{1}
and, based on the dofor loop

Code: Select all

cal(d) 2010:1:1
dec vect[int] monthends(88)

ewise monthends(i)=(%year(1):(%month(1)+3+i):1)-1

dofor time = monthends
   compute rstart=%year(time):(%month(time)-3):1
   compute rend=time


   stats(noprint) rEEM_C rstart rend
   compute rEEM_C_mu = %mean
   compute rEEM_C_std = sqrt(%variance)

   stats(noprint) rIEF_C rstart rend
   compute rIEF_C_mu = %mean
   compute rIEF_C_std = sqrt(%variance)

   stats(noprint) rIEV_C rstart rend
   compute rIEV_C_mu = %mean
   compute rIEV_C_std = sqrt(%variance)

   stats(noprint) rMDY_C rstart rend
   compute rMDY_C_mu = %mean
   compute rMDY_C_std = sqrt(%variance)

   stats(noprint) rQQQ_C rstart rend
   compute rQQQ_C_mu = %mean
   compute rQQQ_C_std = sqrt(%variance)

   stats(noprint) rTLT_C rstart rend
   compute rTLT_C_mu = %mean
   compute rTLT_C_std = sqrt(%variance)

   stats(noprint) rXLV_C rstart rend
   compute rXLV_C_mu = %mean
   compute rXLV_C_std = sqrt(%variance)

   cmom(corr,noprint) rstart rend
   # rEEM_C	rIEF_C rIEV_C rMDY_C rQQQ_C rTLT_C rXLV_C
   compute rEEM_C_avg_cmom = ( ( %sum(%xcol(%cmom,1) )) - 1 ) / (%ncmom - 1)
   compute rIEF_C_avg_cmom = ( ( %sum(%xcol(%cmom,2) )) - 1 ) / (%ncmom - 1)
   compute rIEV_C_avg_cmom = ( ( %sum(%xcol(%cmom,3) )) - 1 ) / (%ncmom - 1)
   compute rMDY_C_avg_cmom = ( ( %sum(%xcol(%cmom,4) )) - 1 ) / (%ncmom - 1)
   compute rQQQ_C_avg_cmom = ( ( %sum(%xcol(%cmom,5) )) - 1 ) / (%ncmom - 1)
   compute rTLT_C_avg_cmom = ( ( %sum(%xcol(%cmom,6) )) - 1 ) / (%ncmom - 1)
   compute rXLV_C_avg_cmom = ( ( %sum(%xcol(%cmom,7) )) - 1 ) / (%ncmom - 1)


   compute [vect] m = || rEEM_C_mu,  rIEF_C_mu,  rIEV_C_mu,  rMDY_C_mu,  rQQQ_C_mu,  rTLT_C_mu,  rXLV_C_mu ||
   compute [vect] mt = || 1/exp(rEEM_C_mu),  1/exp(rIEF_C_mu),  1/exp(rIEV_C_mu),  1/exp(rMDY_C_mu),  1/exp(rQQQ_C_mu),  1/exp(rTLT_C_mu),  1/exp(rXLV_C_mu) ||

   compute [vect] v = || rEEM_C_std, rIEF_C_std, rIEV_C_std, rMDY_C_std, rQQQ_C_std, rTLT_C_std, rXLV_C_std ||
   compute [vect] c = || rEEM_C_avg_cmom, rIEF_C_avg_cmom, rIEV_C_avg_cmom, rMDY_C_avg_cmom, rQQQ_C_avg_cmom, rTLT_C_avg_cmom, rXLV_C_avg_cmom||

   compute mRank = %ranks(m)
   compute mtRank = %ranks(mt)
   compute vRank = %ranks(v)
   compute cRank = %ranks(c)

   compute score = (1.0+0.001)*mtRank + 0.5*vRank + 0.5*cRank

   disp %datelabel(rstart) %datelabel(rend) "mu       "  rEEM_C_mu rIEF_C_mu rIEV_C_mu rMDY_C_mu rQQQ_C_mu rTLT_C_mu rXLV_C_mu
   disp %datelabel(rstart) %datelabel(rend) "mut      "  1/exp(rEEM_C_mu)  1/exp(rIEF_C_mu)  1/exp(rIEV_C_mu)  1/exp(rMDY_C_mu)  1/exp(rQQQ_C_mu)  1/exp(rTLT_C_mu)  1/exp(rXLV_C_mu)
   disp %datelabel(rstart) %datelabel(rend) "sig      "  rEEM_C_std rIEF_C_std rIEV_C_std rMDY_C_std rQQQ_C_std rTLT_C_std rXLV_C_std
   disp %datelabel(rstart) %datelabel(rend) "avgCorrel"  rEEM_C_avg_cmom rIEF_C_avg_cmom rIEV_C_avg_cmom rMDY_C_avg_cmom rQQQ_C_avg_cmom rTLT_C_avg_cmom rXLV_C_avg_cmom
   disp
   disp mRank
   disp mtRank
   disp vRank
   disp cRank
   disp
   disp score
end dofor time
Please check if the above is correct/incorrect?

If correct, I would like to create a DAILY cumulative equity curve (although I appreciate RATS is for econometrics) & calculate various statistics: CAR, VOL, MAXDD, based on capital with the strategy rules as previously stated:
Assuming an initial capital of $100,000, the strategy would EQUALLY (current capital divide by 3) go LONG the TOP 3 per MONTH. From those RANKED TOP 3 (lowest score) replace any asset with M <= 0 for cash, as a proxy for cash returns use IEF.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Simple Rotational System (FAA)

Unread post by TomDoan »

I'm not sure what "updated on a daily basis" means. The historical data doesn't change, does it? So all that changes is the current month. And what would you compute for a partial month?
ac_1
Posts: 495
Joined: Thu Apr 15, 2010 6:30 am

Re: Simple Rotational System (FAA)

Unread post by ac_1 »

And what would you compute for a partial month?
A way to update would be to use the Open price for & on the last day of the month and watch the market until close.

I will transfer results to Excel and build the strategy.

Cheers,
Amarjit
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Simple Rotational System (FAA)

Unread post by TomDoan »

Didn't you have some statistics where high was good and some where low was good? As you've written that, it looks like you're aggregating the straight ranks on all of them.
ac_1
Posts: 495
Joined: Thu Apr 15, 2010 6:30 am

Re: Simple Rotational System (FAA)

Unread post by ac_1 »

Didn't you have some statistics where high was good and some where low was good?
Yes.
I think the score equation aggregation & ranking is correct.

Previously, I meant to say Close prices up until using the Open price for the last day of the month, then watch the market during the day, and thereafter rebalance, just before Close :)
ac_1
Posts: 495
Joined: Thu Apr 15, 2010 6:30 am

Re: Simple Rotational System (FAA)

Unread post by ac_1 »

What I have calculated for momentum is the MEAN of the returns over the last 4 month's chunk of data.

I think what the paper describes as being momentum is (p(t)/p(t-4)) - 1.

If I use SET to calculate this within the dofor loop I am unable to display the results. Please instruct on how.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Simple Rotational System (FAA)

Unread post by TomDoan »

Wouldn't that ratio be the price at the end of the window (entry rend) divided by the price at the start (entry rstart, or actually rstart-1 since you want the total return over the window).

Also, won't average log returns give you exactly the same rank ordering as that? (Different values, but the same order).
ac_1
Posts: 495
Joined: Thu Apr 15, 2010 6:30 am

Re: Simple Rotational System (FAA)

Unread post by ac_1 »

Yes, because log returns are time-additive and simple returns are not.
Post Reply