Error computing super trend indicator

Hello All,

I'm trying to compute a supertrend indicator, but I cannot manage to compute correctly the final lower and upper bands. I dont understand why the np.where formula do not give the desired output, i.e.:

IF basic_upper_band(n) < final upper band(n-1) OR close price(n-1) > final_upper_band(n-1):
final_upper_band(n) = basic_upper_band(n)
ELSE
final_upper_band(n) = basic_upper_band(n-1)

I systematically get final_upper_band(n) = basic_upper_band(n), like if the first condition was always true, while it's not...