python pip install TA-Lib python import talib import numpy as np import pandas as pd python df = pd.read_csv(f'https://query1.finance.yahoo.com/v7/finance/download/{symbol}?period1={start_date}&period2={end_date}&interval=1d&events=history') python macd, signal, _ = talib.MACD(close_price) python import matplotlib.pyplot as plt plt.figure(figsize=(12, 6)) plt.plot(df['Close'], label='Close Price', color='blue') plt.plot(macd, label='MACD', color='red') plt.plot(signal, label='Signal Line', color='green') plt.legend() plt.title('MACD Indicator Analysis') plt.xlabel('Date') plt.ylabel('Price') plt.show()


上一篇:
下一篇:
切换中文