From ad766a716f8ae8420f8b3b819e36ae61bd99611e Mon Sep 17 00:00:00 2001 From: filipniko Date: Fri, 11 Nov 2022 10:02:12 +0100 Subject: [PATCH] Adjusting supertrend evaluation by comparing previous close value instead of current --- stockstats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stockstats.py b/stockstats.py index 3c66b8e..9db3afe 100644 --- a/stockstats.py +++ b/stockstats.py @@ -586,12 +586,12 @@ def _get_supertrend(self, window=None): # calculate supertrend if last_st == last_ub: - if curr_close <= ub[i]: + if curr_close <= last_ub: st[i] = ub[i] else: st[i] = lb[i] elif last_st == last_lb: - if curr_close > lb[i]: + if curr_close > last_lb: st[i] = lb[i] else: st[i] = ub[i]