diff --git a/Zeus_11.py b/Zeus_11.py index d74298d..b7348cb 100644 --- a/Zeus_11.py +++ b/Zeus_11.py @@ -369,7 +369,7 @@ class Zeus_11(IStrategy): dataframe["percent48"] = (dataframe["close"] - dataframe["open"].shift(48)) / dataframe["open"].shift(48) # print(metadata['pair']) - dataframe['rsi'] = talib.RSI(dataframe['close'], length=14) + dataframe['rsi'] = talib.RSI(dataframe['close'], timeperiod=14) # Bollinger Bands bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2) @@ -436,7 +436,7 @@ class Zeus_11(IStrategy): # informative["max_profit"] = dataframe["informative"].rolling(n_candles).max() # informative["profit_hit"] = dataframe["informative"] >= informative["close"] * (1 + x_percent) # - informative['rsi'] = talib.RSI(informative['close'], length=7) + informative['rsi'] = talib.RSI(informative['close'], timeperiod=7) informative['rsi_diff'] = informative['rsi'] - informative['rsi'].shift(1) informative['sma5'] = talib.SMA(informative, timeperiod=5) @@ -445,7 +445,7 @@ class Zeus_11(IStrategy): ################### INFORMATIVE 1d informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe="1d") - informative['rsi'] = talib.RSI(informative['close'], length=7) + informative['rsi'] = talib.RSI(informative['close'], timeperiod=7) informative['rsi_diff'] = informative['rsi'] - informative['rsi'].shift(1) informative['sma5'] = talib.SMA(informative, timeperiod=5) informative['sma5_pct'] = 100 * (informative['sma5'] - informative['sma5'].shift(1)) / informative['sma5'] diff --git a/tools/graph.py b/tools/graph.py new file mode 100644 index 0000000..5205bd7 --- /dev/null +++ b/tools/graph.py @@ -0,0 +1,34 @@ +import pandas as pd +import matplotlib.pyplot as plt + +# Charger les fichiers +signals = pd.read_pickle('backtest-result-2025-04-06_21-30-24_signals.pkl') +exited = pd.read_pickle('backtest-result-2025-04-06_21-30-24_exited.pkl') +rejected = pd.read_pickle('backtest-result-2025-04-06_21-30-24_rejected.pkl') # facultatif + +# Choisir un marché pour le graphique (ex : BTC/USDT) +pair = 'BTC/USDT' +df_signals = signals[signals['pair'] == pair] +df_exited = exited[exited['pair'] == pair] + +# Charger les données de prix si besoin (par ex. OHLCV depuis Freqtrade) +# Ici on suppose que vous avez une DataFrame de prix : price_df avec ['date', 'close'] +price_df = df_signals[['date', 'price']].rename(columns={'price': 'close'}).copy() +price_df.set_index('date', inplace=True) + +# Affichage +plt.figure(figsize=(14, 6)) +plt.plot(price_df.index, price_df['close'], label='Prix', color='gray') + +# Ajouter les points d'entrée +plt.scatter(df_signals['date'], df_signals['price'], color='green', label='Signal', marker='^') +# Ajouter les points de sortie +plt.scatter(df_exited['exit_date'], df_exited['exit_price'], color='red', label='Sortie', marker='v') + +plt.title(f"Graphique avec signaux pour {pair}") +plt.xlabel("Date") +plt.ylabel("Prix") +plt.legend() +plt.grid(True) +plt.tight_layout() +plt.show() diff --git a/tools/test_pkl.py b/tools/test_pkl.py new file mode 100644 index 0000000..2962c2d --- /dev/null +++ b/tools/test_pkl.py @@ -0,0 +1,3 @@ +import pandas as pd +df = pd.read_pickle("backtest-result-2025-04-06_21-30-24_signals.pkl") +print(df.head())