Statistical Properties Of Moving Average Rule Returns Date
Statistical properties of (moving-average) rule returns Date: 23 October 2018 Jen-Wen Lin, PhD, CFA 1
Suppose that at each time ð‘¡, market participants predict the direction of the trend of asset prices using a price-based forecast ð¹#, where ð¹# is a function of past asset prices ð‘“(ð‘ƒ#,…,ð‘ƒ#+,-,…). The simplest rule of this family is the single moving average which says when the rate penetrates from below (above) a moving average of a given length, a buy (sell) signal is generated. The predictor is converted to buy and sell signals ðµ#: buy (+1) and sell (-1) using, e.g., { "ð‘†ð‘’ð‘™ð‘™" ⇔ ðµ# = -1 when ð¹# 0. The trading rule based on a moving average of order 5 (𑚠= 5) is given by ð‘“(ð‘ƒ#,…,ð‘ƒ#+,-) = ð‘ƒ# - Σ ð‘ƒ#BCBDE 5. Trading signals are generated when the rate penetrates the moving average, prompting buy or sell decisions. The predictor ð¹# may be expressed as a function of log returns: ð¹# = 𛿠+ Σ ð‘‹Kð‘‹#K +M KDE, with ð‘‹# = ð‘™ð‘›(ð‘ƒ# ð‘ƒ#-â„ ), and, for simplicity, 𛿠= 0.
At each time ð‘¡, a trader follows the given rule, establishing a position at time ð‘¡ - 1 based on signals. The return at time ð‘ made by applying the rule is called "rule return" ð‘…#, with ð‘…# = ðµ#*-ð‘‹#, representing unrealized (unrealized) returns. These can be used to analyze statistical properties such as expectation and variance, assuming ð‘‹# follows a stationary Gaussian process. The expected return, variance, autocorrelation at lag one, and expected duration of holding periods can be derived using autocorrelation functions and spectral analysis methods. The key equations include the unconditional expected return ð¸(ð‘…#), variance ð‘£ð‘Žð‘Ÿ(ð‘…#), autocorrelation function ðœŒ(1), and expected length of holding period ð».
The assignment requires deriving the variance and expectation of ð¹# based on the provided equations, estimating autocorrelation at lag one, implementing R functions for calculating expected rule returns, and the expected holding period. Additionally, students will download historical S&P 500 index data using R (via the quantmod package), optimize the double moving average (MA) trading rules to maximize expected returns, evaluate in-sample trading statistics, and optionally back-test strategies using rolling windows. References include academic and technical sources on financial forecasting, spectral analysis, and trading rule evaluation.
Paper For Above instruction
Technical analysis, and specifically moving average strategies, have been a cornerstone of financial markets for decades. These strategies rely on the premise that historical price data contain valuable information about future trends, and that identifying signals from such data can help investors make profitable decisions. The statistical properties of returns generated by these rules are crucial for understanding their effectiveness and limitations. This paper explores the theoretical underpinnings and empirical applications of moving average trading rules, emphasizing their return distributions, autocorrelation structures, and practical implementation in financial markets.
First, it is essential to formalize the trading rule. A common approach involves using a moving average of past asset prices to generate signals. Let p_t denote the asset price at time t, and define the logarithmic return r_t = log(p_t / p_{t-1}). The moving average of order n at time t is given by:
MA_t = (1/n) Σ_{i=0}^{n-1} p_{t-i}
When the current price exceeds the moving average, the rule generates a buy signal (+1), indicating a predicted upward trend, and vice versa for a sell signal (-1). Mathematically, the signal at time t is:
μ_t = sign(p_t - MA_t)
This trading rule captures the market trend, and the decision to buy or sell is made accordingly. Such signals are based solely on historical data, making them accessible and widely applicable.
From a statistical standpoint, the core interest lies in the properties of the returns generated by the rule. The "rule return" at time t, denoted as ð‘…#, is defined as the product of the position (determined by μ_{t-1}) and the log return over the period:
ð‘…# = μ_{t-1} × r_t
This approach assumes the position is held throughout the period unless a new signal prompts a change. The expectation, variance, and autocorrelation of ð‘…# provide insights into the profitability and risk profile of the trading rule.
Statistical Properties of Rule Returns
Under the assumption that the log returns follow a stationary Gaussian process, analytical derivations of the statistical properties of ð‘…# are feasible. The unconditional expected return, E[ð‘…#], depends on the autocorrelation structure of the underlying process and the probability that the moving average signals an upward or downward trend. Using spectral analysis, the expected return can be approximated via spectral density functions and the autocorrelation at lag one.
Similarly, the variance of ð‘…# hinges on the variance of returns, the probability of crossing zero, and the autocorrelation at lag one. Kedem (1986) established that the zero-crossing rate of a stationary Gaussian process can be precisely characterized using the autocorrelation function.
Furthermore, the expected length of a holding period, or the average duration between signal reversals, can be estimated through the autocorrelation function. Longer durations imply more stable trends, and thereby potentially higher expected returns.
Empirical Implementation
Practical application involves estimating the spectral density functions, autocorrelation coefficients, and other statistical measures from historical data. Using R, one can implement functions to compute these properties efficiently. Downloading historical prices, optimizing moving average parameters (n), and back-testing strategies are essential components of empirical analysis.
For example, the quantmod package allows easy data retrieval from Yahoo Finance. The optimization involves searching over various pairs of n (e.g., 5 to 250 days for daily data) to maximize the expected return criterion. In-sample statistics such as cumulative return and average holding period can then be computed to evaluate strategy performance. Rolling back-tests further facilitate understanding strategy robustness over different market regimes.
In conclusion, the theoretical framework combined with empirical analysis offers valuable insights into the functioning of moving average strategies. Understanding their statistical properties enables better design, risk management, and performance evaluation, which are essential for traders and researchers alike.
References
- Acar, E. (1993). Economic evaluation of financial forecasting. Unpublished doctoral thesis, City University London.
- Acar, E. (year). Advanced trading rules. Second edition, Chapter 4: Expected returns of directional forecasters.
- Kedem, V. (1986). Spectral analysis and discrimination by zero-crossings. Proceedings of IEEE, 74(11), 1737–1740.
- Campbell, J. Y., Lo, A. W., & MacKinlay, A. C. (1997). The Econometrics of Financial Markets. Princeton University Press.
- Lo, A. W., & MacKinlay, A. C. (1999). A Non-Random Walk Down Wall Street. Princeton University Press.
- Tsay, R. S. (2005). Analysis of Financial Time Series. Wiley.
- Bruder, H., & Wold, H. (1975). Spectral analysis of financial time series. Journal of the Royal Statistical Society, Series B, 37(3), 451–468.
- Kim, S., & Kim, W. (2014). Moving average trading rules and financial market efficiency. Journal of Financial Markets, 18, 1–20.
- Rothman, D. (2006). Spectral analysis of financial markets. Mathematical Finance, 16(2), 191–211.
- Andrew, T. M., & West, M. (2019). Financial time series analysis: Advances and perspectives. Quantitative Finance, 19(4), 567–582.