Last Updated on November 15, 2021 by shibatau
Typos are corrected.
I.What do you learn?
Let me show you what Simple Moving Average is and how it works using real stock prices with Python on Google Colaboratory.
You can see all of my scripts here, though they are not completed.
https://colab.research.google.com/drive/1x6Rr_gB_BsCoQvL3wsWlRIY3-ZH2eACq?usp=sharing
I have learned about SMA mainly from the following article, but I have gotten data with yfinance instead of a downloaded file and create a chart with Plotly on Google Colaboratory.
Building a Financial Trading Toolbox in Python: Simple Moving Average
II.Simple Moving Average
1.What is Simple Moving Average?
Simple Moving Average (SMA) is one of the most commonly used moving averages.
The Formula for SMA is:
$$SMA = {A_1 + A_2 + A_3 + ・・・ + A_n\over n}$$
where:
n is the number of total periods,
An is the price at period n.
2.How does Simple Moving Average work?
SMA reduces noises, smoothes price movements and identifies the trend more clearly. It also shows some trading signals. When the closing price crosses over the moving average from below, you have a buy signal. Similarly, when the price crosses over the moving average from above, you have a sell signal. Generally speaking, you can say that crossovers signify trend reversals, though you should also note that SMA is a lagging indicator. No moving averages including SMA are flawless.
