Finance: Simple Moving Average ver. 2

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. 

 
To be continued.
 

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.