The "bb_riding" strategy is a trading strategy that uses Bollinger Bands (BB) and Moving Average Convergence Divergence (MACD) indicators to determine buy and sell signals. Here's a breakdown of what the strategy does:
It sets the minimal return on investment (ROI) target to 0.3, meaning that when a trade reaches a profit of 0.3, it should be closed. It sets the stop loss at -0.235, which means that if a trade reaches a loss of 0.235, it should be closed.
The strategy operates on a 30-minute timeframe.
It calculates the Bollinger Bands using the 20-period moving average with two standard deviations.
The upper band, middle band, and lower band are stored in separate columns in the dataframe. It calculates the width of the Bollinger Bands by dividing the difference between the upper and lower bands by the middle band. It calculates the MACD line, signal line, and histogram using the default parameters. In the "populate_buy_trend" method, the strategy generates a buy signal when the closing price is above the upper Bollinger Band and the width of the Bollinger Bands is greater than 0.02. In the "populate_sell_trend" method, the strategy generates a sell signal when the MACD signal line is below 0. The strategy uses these indicators to identify potential entry and exit points for trades based on price movements and market trends.