Search This Blog

Thursday, March 7, 2019

Using spreadsheet to produce WMA (Weighted Moving Averages) and EMA (Exponential smoothing Moving Averages) indicators

Stock Exchange and Market Analysis
Technical Analysis (2) sequel

In the previous stock technical analysis (2) explained how to establish a simple moving average and deviation rate, today we further establish a weighted moving average for the moving average and A sample of the exponentially smoothed moving average. First, import the Excel spreadsheet based on the mathematical formulas of both:
1. n- day weighted moving average:
    (WMA:Weighted Moving Average)
    WMAt
    = (Ct * n + Ct-1 * (n-1) + … + Ct-n+1 * 1) / (n + (n - 1) + … + 1)
    = (Ct * n + Ct-1 * (n-1) + … + Ct-n+1 * 1) / ((n+1) * n /2)
   Where
    WMA t : n-day weighted moving average on day t
    C t : the closing price of the tth day
2. n- day exponential smoothing moving average:
   EMA:Exponential Moving Average
   There are currently two calculation methods on the market, which are described as follows:
i. EMA t
   = EMA t-1 + K * (100 t - EMA t-1 )
   = K * C t + (1-K) * EMA t-1
   = (2 * C t + (n-1) * EMA t-1 ) / (n + 1)
   Wherein K = 2 / (n + 1)
   EMA t : n-day exponential smoothing moving average on day t
ii. EMA t = (C t + (n-1) * EMA t-1 ) / n
The second algorithm (ii) actually reduces the proportion of the closing price of the day, making the trend of the moving average smoother.
If you want to understand the definition and application principles of the above technical indicators, you can refer to the explanation on Wikipedia (Ref.1). Finally, the author made the analysis samples of the above two technical indicators for readers' reference:
Template2_1.xls
This sample provides information on the period of 2003/1/22-2014/01/20 based on Juyang. If there are any mistakes, please correct me and let the information compiled more accurately and usefully. Thank you! Class indicators (moving average, RSI, BIAS, stochastic KD line, William indicator, MACD and Bollinger band, etc.) produced the EXCEL spreadsheet for readers' reference, and further produced candlestick charts and other technical indicators. Above, interested readers can refer to Ref.2. Stay tuned.
Reference (Ref):
1. Wikipedia: Moving Average - Wikipedia, the free encyclopedia
2. Investment Financial Notes - Stock Technical Analysis
























No comments:

Post a Comment