Search
Products
Community
Markets
News
Brokers
More
IN
Get started
Community
/
Ideas
/
خصوصي
US 500
خصوصي
By fffd1405
Follow
Follow
2 days ago
0
2 days ago
import pandas as pd
import numpy as np
import talib
# تحميل بيانات SPX
data = pd.read_csv("SPX_data.csv") # استبدل ببيانات SPX
data['EMA_9'] = talib.EMA(data['Close'], timeperiod=9)
data['EMA_21'] = talib.EMA(data['Close'], timeperiod=21)
data['RSI'] = talib.RSI(data['Close'], timeperiod=14)
data['Upper'], data['Middle'], data['Lower'] = talib.BBANDS(data['Close'], timeperiod=20, nbdevup=2, nbdevdn=2)
# إشارات الشراء والبيع
data['Buy_Signal'] = (data['EMA_9'] > data['EMA_21']) & (data['RSI'] < 40) & (data['Close'] < data['Lower'])
data['Sell_Signal'] = (data['EMA_9'] < data['EMA_21']) & (data['RSI'] > 60) & (data['Close'] > data['Upper'])
print(data[['Close', 'Buy_Signal', 'Sell_Signal']])
Trend Analysis
fffd1405
Follow
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the
Terms of Use
.