The bb_rsi_opt strategy is a trading strategy that combines Bollinger Bands and the Relative Strength Index (RSI) indicators to generate buy and sell signals. Here is a brief description of what the strategy does:
In the populate_indicators method:
Calculates the RSI indicator using the ta.RSI function and adds it to the dataframe. Calculates two sets of Bollinger Bands using the qtpylib.bollinger_bands function with different standard deviations (1 and 4).
Adds the lower, middle, and upper bands of each set of Bollinger Bands to the dataframe.
In the populate_buy_trend method:
Identifies potential buy signals based on the following conditions:
RSI value is greater than 28.
Close price is lower than the lower band of the Bollinger Bands with 4 standard deviations. Assigns a value of 1 to the 'buy' column in the dataframe for the identified buy signals. In the populate_sell_trend method:
Identifies potential sell signals based on the following conditions:
RSI value is greater than 90. Close price is higher than the upper band of the Bollinger Bands with 1 standard deviation. Assigns a value of 1 to the 'sell' column in the dataframe for the identified sell signals. The strategy uses these buy and sell signals to make trading decisions.