From ac0d4729f7939a382bfb3962c8a875391ae95556 Mon Sep 17 00:00:00 2001 From: Akash <71017798+akashamar@users.noreply.github.com> Date: Sat, 29 Nov 2025 18:48:26 +0530 Subject: [PATCH] Fix Supertrend strategy for NumPy 2.x compatibility - Replaced `np.NaN` with `None` to ensure compatibility with NumPy 2.x. - Prevents AttributeError during backtesting in freqtrade with NumPy 2.x. --- user_data/strategies/Supertrend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_data/strategies/Supertrend.py b/user_data/strategies/Supertrend.py index 5421bc7..1ab90b0 100644 --- a/user_data/strategies/Supertrend.py +++ b/user_data/strategies/Supertrend.py @@ -164,7 +164,7 @@ class Supertrend(IStrategy): df['final_lb'].iat[i] if df[st].iat[i - 1] == df['final_lb'].iat[i - 1] and df['close'].iat[i] >= df['final_lb'].iat[i] else \ df['final_ub'].iat[i] if df[st].iat[i - 1] == df['final_lb'].iat[i - 1] and df['close'].iat[i] < df['final_lb'].iat[i] else 0.00 # Mark the trend direction up/down - df[stx] = np.where((df[st] > 0.00), np.where((df['close'] < df[st]), 'down', 'up'), np.NaN) + df[stx] = np.where((df[st] > 0.00), np.where((df['close'] < df[st]), 'down', 'up'), None) # Remove basic and final bands from the columns df.drop(['basic_ub', 'basic_lb', 'final_ub', 'final_lb'], inplace=True, axis=1)