AMC finally AMC Entertainment Holdings, Inc.BATS:AMCLuaiimseeh1982import yfinance as yf import matplotlib.pyplot as plt # تحميل بيانات AMC ticker = "AMC" data = yf.download(ticker, start="2024-01-01", interval="1d") # حساب RSI window_length = 14 delta = data.diff() gain = delta.where(delta > 0, 0) loss = -delta.where(delta < 0, 0) avg_gain = gain.rolling(window=window_length).mean() avg_loss = loss.rolling(window=window_length).mean() rs = avg_gain / avg_loss rsi = 100 - (100 / (1 + rs)) # حساب MACD ema12 = data.ewm(span=12, adjust=False).mean() ema26 = data.ewm(span=26, adjust=False).mean() macd = ema12 - ema26 signal = macd.ewm(span=9, adjust=False).mean() # حساب EMA 20 و EMA 50 ema20 = data.ewm(span=20, adjust=False).mean() ema50 = data.ewm(span=50, adjust=False).mean() # رسم الشارت plt.figure(figsize=(12,8)) # السعر + EMA plt.subplot(3,1,1) plt.plot(data.index, data, label="Close Price", color="black") plt.plot(data.index, ema20, label="EMA 20", linestyle="--") plt.plot(data.index, ema50, label="EMA 50", linestyle="--") plt.title("AMC Price with EMA") plt.legend() # MACD plt.subplot(3,1,2) plt.plot(data.index, macd, label="MACD", color="blue") plt.plot(data.index, signal, label="Signal", color="red") plt.axhline(0, color="gray", linestyle="--") plt.legend() plt.title("MACD") # RSI plt.subplot(3,1,3) plt.plot(data.index, rsi, label="RSI", color="purple") plt.axhline(70, color="red", linestyle="--") plt.axhline(30, color="green", linestyle="--") plt.legend() plt.title("RSI") plt.tight_layout() plt.show()