0 Ambil chart ini Ambil chart ini import pandas as pd import numpy as np # Super Trend hesaplama fonksiyonu def calculate_super_trend(data, atr_period, multiplier): tr = data['High'] - data['Low'] atr = tr.rolling(atr_period).mean() super_trend_upper = data['High'] - (multiplier * atr) super_trend_lower = data['Low'] + (multiplier * atr) data['SuperTrend'] = (super_trend_upper + super_trend_lower) / 2 return data # Bollinger Bands hesaplama fonksiyonu def calculate_bollinger_bands(data, window, num_std_dev): rolling_mean = data['Close'].rolling(window=window).mean() rolling_std = data['Close'].rolling(window=window).std() data['BollingerUpper'] = rolling_mean + (rolling_std * num_std_dev) data['BollingerLower'] = rolling_mean - (rolling_std * num_std_dev) return data # Veriyi yükle data = pd.read_csv('your_data.csv') data['Date'] = pd.to_datetime(data['Date']) data.set_index('Date', inplace=True) # Super Trend ve Bollinger Bands hesaplama atr_period = 14 multiplier = 1.0 bollinger_window = 20 num_std_dev = 2.0 data = calculate_super_trend(data, atr_period, multiplier) data = calculate_bollinger_bands(data, bollinger_window, num_std_dev) # Al-Sat kararları data['Buy_Signal'] = np.where(data['Close'] > data['SuperTrend'], 1, 0) data['Sell_Signal'] = np.where(data['Close'] < data['SuperTrend'], -1, 0) data['Buy_Signal'] = np.where(data['Close'] > data['BollingerUpper'], 1, data['Buy_Signal']) data['Sell_Signal'] = np.where(data['Close'] < data['BollingerLower'], -1, data['Sell_Signal']) # Al-Sat sinyallerini birleştirme data['Signal'] = data['Buy_Signal'] + data['Sell_Signal'] # Veriyi gösterme print(data)
Pernyataan Penyangkalan Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di
Persyaratan Penggunaan .