The purpose of this script is to provide in-depth visualizations on stocks that utilize statistical/Forecasting methods, and can assist the user in making stock related decisons(Buy, Sell, Hold). The script runs by asking the user for the list of stocks they would like analyzed and generates various powerful visualizations for the user.
To run this script simply download and execute the python file, and ensure that you have required modules installed (For yfinance installation use (pip install yfinance))
For all the stocks entered, the script plots the Simple Moving Average(SMA) of 5,10,15 days on the same plot as the stock's close price to show how close the moving averages are to the actual stock price (used to determine stock volatility).
For all the stocks entered, the program plots the Exponential Moving Average(EMA) of 5,10,15 days on the same plot as the stock's close price.
**The difference between the Simple Moving Average(SMA) and Exponential Moving Average(EMA), is that EMA places higher weighting towards recent stock prices, whereas the SMA applies equal weighting for all stock prices.
The script conducts techcnial analysis by calculating the upper, lower, and middle bands on each stock.
The lower and upper band is calculated by taking 2 standard deviations from a 20-day Simple Moving Average of the stock's close price.
The middle band is the stock's Simple Moving Average of a 20-day period
Combining the upper, lower, and middle bands the Bollinger Bands visualization is created.
For the stocks entered by the user, the scripts calculates the covariance(how related the stocks are to each other, value of 0 meaning no relation, and a postive number indicating a postive relation in the same direction)
correlation(a standardized value of the direction and strength between the stocks, its is measured between [-1, +1] ) between the stocks.
The script calculates the normalized closing prices(Xn / Xn-1) for the stocks entered and compares it against the market (SPY), this information is then plotted on the same axis
Using the last 30-days of data for each stock, the stock's closing price is used to calculate standard deviation. This standard deviation value becomes the error value for the error bar plot. The stock's closing price as well as the error-bar is plotted to measure potential volatility with the stock's closing price