I have a CSV file having columns Instrument, Date, Time, Open, High, Low, Close
I want the rows having Current close greater than current upper Bollinger band(20,2)
I found the function bbands
in pandas-ta
but I don't know how to compare it with Current close and how to find upper.
Below is the code that much I tried:
import pandas as pd
import pandas_ta as ta
df = pd.read_csv("NIFTY.csv", parse_dates = [["Date", "Time"]], index_col=0)
currunt_close = df["Close"]
currunt_upper_bollinger_band = ta.bbands(df["Close"], length=20, std=2)
Run this code instead:
currunt_close.ta.bbands(close='Close', length=20, std=2, append=True)
pd.set_option("display.max_columns", None) # show all columns
BBU_20_2.0
is what you looking for!