0

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)
Jay Patel
  • 1,098
  • 7
  • 22

1 Answers1

1

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!

  • Consider using the "code sample" mode for blocks of code and double backticks for inline code: `BBU_20_2.0` – Jhanzaib Humayun Apr 24 '22 at 05:18
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 24 '22 at 05:25