4071 Project

4071 Project

Empirical Study of Moving Average Crossover Strategies using Different Measures

Empirical Study of Different  Measures of Moving Average Strategies

 

 

  1. Introduction

Technical analysis has been around for quite a long time and as the years passed. We can find hundreds of indicators in different forms, while some indicators are more popular than others. But moving averages is always considered as one of the most objective, reliable and useful statistical method, which is widely used in the financial markets to trade all types, foreign exchange and equities.

 

Although moving averages come in various measures, the underlying purpose of those measures stay the same. By tracking the daily price change, traders can easily follow the price trends of the financial assets, which allow traders to decide their long and short position in order to increasing the number of winning trades.

 

Our purpose of this study is aim to applying 4 different measure of moving average strategies to 4 categories of data, and compare the returns of the 4 measures in each category of data.

 

 

 

  1. Theory

 

 

-Simple Moving Average (SMA)

Definition: The simplest form of a moving average, known as a simple moving average (SMA), is calculated by taking the arithmetic mean of a given set of values. For example, to calculate a basic 10-day moving average you would add up the closing prices from the past 10 days and then divide the result by 10. The reason why it is called “moving average” instead of “mean” is because as new values become available, the oldest data points must be dropped from the set and new data points must come in to replace them. This method of calculation ensures that only the current information is being accounted for.

 

Formula:

 

 

-Weighted Moving Average (WMA)

 

Definition:In technical analysis of financial data, a weighted moving average (WMA) has the specific meaning of weights that decrease in arithmetical progression. In an n-day WMA the latest day has weight n, the second latest n − 1, etc., down to 1.

 

Formula:

In general case, the denominator is the sum of the individual weights.

 

 

 

 

 

 

-Triangular Moving Average (TMA)

 

Definition:

The Triangular Moving Average is similar to exponential and weighted Moving averages, but in opposite to the exponential and weighted moving averages which assign the majority of the weight to the most recent data the TMA assigns the weight to the middle portion of the data. As with other MAs the TMA could be used to identify a trend: a trend is considered as bullish when price moves above TMA and a trend is considered as bearish when price moves below TMA. As a rule Triangular Moving averages appears smoother when compared to other MAs. However, TMAs may have more waves as they could be more sensitive to trend changes.

The main principle of MA’s technical analysis states to sell when price or MA with shorter bar period drops below TMA and to buy when price or MA with shorter bar period advances above Triangular Moving Average

Formula and Calculations

The triangular moving average (TMA) is calculated as double smoothed SMA (simple moving average):

SMA = (P1 + P2 + P3 + P4 + … + Pn) / n

TMA = (SMA1 + SMA2 + SMA3 + SMA4 + … SMAn) / n

 

Example:

Suppose we want to get the TMA of the passing 10 days. First, we calculate the the SMA1 from n days ago to n/2-1 days ago, then SMA2 from n-1 days ago to n/2-2 days ago, etc., down to SMAn from n/2+1 days ago to 1 days ago.Then calculate the average of SMA1 to SMAn.

 

 

-Moving Average Convergence-Divergence (MACD)

Exponential moving average is known as “exponentially weighted moving average”, which is basically assign more weight to the latest data.

 

 

Moving Average Convergence-Divergence is a type of moving average, which reacts faster to recent price change than the simple moving average, based on exponential moving average.

In general, we subtract N2-day EMAs from N1-day EMAs to get the MACD line. Then we construct a “signal line”, which is the n3-day EMA.

When MACD line falls below the signal line, it indicate the time to take a short position. Conversely, when ACD line rise above the signal line, it indicate the time to take a long position.

 

 

  1. Empirical Design

This project aims to compare the return of moving average crossover strategy using four different measures. According to the strategy, when the short-term moving average goes above the long-term moving average, the strategy would short the equity; while the strategy would long when the short-term moving average cross below the long-term moving average. In this empirical study, we start with an initial investment of $1,000,000 in a portfolio consisting of 5 stocks. We then simulate the moving average crossover strategy and obtain the total return, based on the following four different measures:

  1. Singular Moving Average (SMA)

(例:求2015年1月10号的10-day SMA:pM=2015年1月10号的股价,pM-(n-1)=2015年1月1号的股价,n=10)

(SMA是一个从data第Ni天到最后一天的数列)

  1. Weighted Moving Average (WMA)

(WMA是一个从data第Ni天到最后一天的数列)

  1. Triangular Moving Average (TMA)

(例:求2015年1月10号的10-day TMA:用过去10天(2015年1月1号-10号)的 5-day SMA求TMA)

(TMA是一个从data第Ni天到最后一天的数列)

(For t=M, SMA(-1) is the SMA(M), SMA(-n) is SMA(M-n+1).)

  1. Exponential Moving Average (EMA)

The empirical study follows the following steps:

For Singular Moving Average, Weighted Moving Average and Triangular Moving Average:

  • Calculate the daily return of each stock ri for each stock in the portfolio
  • For each stock, obtain the N1-day, N2-day and N3-day SMA, WMA and TMA using the above formula (For example, N1= 10, N1= 20, N1= 60)
  • The algorithm measures two strategies:
  • Short-term strategy: when the N1-day moving average cross above N2-day, the algorithm sells all the holdings of the stock; when the N1-day moving average cross below N2-day, the algorithm buys the stock in full.
  • Long-term strategy: when the N2-day moving average cross above N3-day, the algorithm sells all the holdings of the stock; when the N2-day moving average cross below N3-day, the algorithm buys the stock in full.
  • Print out the gross return on the last day (the last day of the data)
  • Draw the graph including the stock price and N1-day, N2-day and N3-day moving average line. Denote the buy and sell point on the graph.

 

For Moving Average Convergence-Divergence(MACD):

  • Calculate the daily return of each stock ri for each stock
  • For each stock, obtain the N1-day, N2-day and N3-day EMA moving average using the above formula (For example, N1= 12, N2= 26, N3= 9)
  • Calculate MACD = EMA12-EMA
  • The strategy is as follow:
  • When the MACD cross above N3-day, the algorithm sells all the holdings of the stock; when the MACD-day moving average cross below N3-day, the algorithm buys the stock in full.
  • Print out the gross return on the last day (the last day of the data)
  • Draw the graph including the stock price and MACD and N3-day moving average line. Denote the buy and sell point on the graph. (如下图,上半部分为股价,下半部分为MACD和9-Day EMA)

 

  1. Data
  • To evaluate the effectiveness of these four different measures of moving average to four groups of different kinds of stocks. High-volatility stocks, low-volatility stocks, large-market-capitalization stocks and small-market-capitalization stocks. To ensure the randomness, our team select five stocks from market for each group of stocks. Download the close price for each stocks in last five years and construct 10 days (20 days and 60 days) moving average lines for each stock.The reason why to choose 10 day, 20 day and 60 day moving average lines is because these lines performs well for five-year trading period.

 

  • To  compare the effectiveness for short term trading and long term trading . Our team use 10 day moving average line and 20 day moving average line to construct a short term crossover strategy and use 20 day moving average line and 60 day moving average line to construct a long term crossover strategy. After comparing the results of these two strategy, our team is able to find the better one.

 

  • To check whether the crossover strategy is better than index fund or not. Our team only need to compare the accumulated return of crossover strategy and net change of S&P 500 index in last five years.

 

 

 

  1. Result