Assignment instruction
Question 1 to 3:
Derive the formula using a general model (don’t need to simplify to double MA).
Question 4:
Write a R function as follows:
Q4<-function (S = S&P500, m=length_of_long_term_MA, r=length_of_short_term_MA)
This function returns two output and , where
Use the results that you derive from Question 1 to Question 3. For example,
1. is the sample standard deviation of log S&P500 index.
2. , where use the sample mean of log returns.
Question 6:
The most naïve way to solve this question is to write a double loop over feasible sets of and , where and , for daily and weekly frequency. Within the loop, and are the augments to Q4 and return for each iteration. The pair of and that give you the maximum is your optimal choice.
For students who cannot do a full search, you may simplify your computation by considering
· , and , for daily frequency.
· , and , for weekly frequency.
Question 7:
1. Use your optimal choice in Question 6 to answer this question and let denote your optimal choice.
2. Cumulative return ():
where is the number of active trading days in your analysis, is the position at the end of period , is the log return over period .
The estimate of may be given by
3. The length of the (averaged) holding periods:
The above formula provides the estimate of .