This commit is contained in:
infidel
2022-04-06 14:56:09 +07:00
commit eb3dc17ee6
41 changed files with 4898 additions and 0 deletions

16
indicator_MACD.py Normal file
View File

@@ -0,0 +1,16 @@
import yfinance as yf
import pandas as pd
import matplotlib.pyplot as plt
def macd_data(data):
tick_history = data
tick_macd = pd.DataFrame()
tick_macd['Close'] = tick_history['Close']
tick_macd['EMA-12'] = tick_macd['Close'].ewm(span=12, adjust=False).mean()
tick_macd['EMA-26'] = tick_macd['Close'].ewm(span=26, adjust=False).mean()
tick_macd['MACD'] = tick_macd['EMA-12'] - tick_macd['EMA-26']
tick_macd['Signal'] = tick_macd['MACD'].ewm(span=9, adjust=False).mean()
tick_macd['Gap'] = tick_macd['MACD'] - tick_macd['Signal']
print(tick_macd.index)
return tick_macd