The "bb_riding" strategy is a backtesting strategy that utilizes Bollinger Bands and MACD indicators to generate buy and sell signals for trading. Here's a breakdown of what the strategy does:
Bollinger Bands: The strategy calculates the Bollinger Bands using a time period of 20 and a standard deviation of 2.0. It adds three columns to the dataframe: "bb_lower" (lower band), "bb_middle" (middle band), and "bb_upper" (upper band).
Bollinger Band Width: The strategy calculates the width of the Bollinger Bands by subtracting the lower band from the upper band and dividing it by the middle band.
It adds a column called "bb_width" to the dataframe.
MACD: The strategy calculates the Moving Average Convergence Divergence (MACD) indicator, which consists of three components: MACD line, MACD signal line, and MACD histogram. It adds three columns to the dataframe: "macd" (MACD line), "macdsignal" (MACD signal line), and "macdhist" (MACD histogram). Buy Signal: The strategy generates a buy signal when the close price is above the upper Bollinger Band and the Bollinger Band width is greater than 0.02. It sets the "buy" column of the dataframe to 1 for the corresponding rows. Sell Signal: The strategy generates a sell signal when the MACD signal line crosses below zero. It sets the "sell" column of the dataframe to 1 for the corresponding rows. The strategy also defines the following parameters:
minimal_roi: A dictionary that sets the minimum return on investment (ROI) for a trade. stoploss: The stop loss value for a trade. timeframe: The timeframe used for the strategy, which is set to '30m' (30 minutes). Overall, the strategy aims to ride the upper Bollinger Band as a buy signal and uses the MACD signal line crossing below zero as a sell signal.