The YABAR strategy is a trading strategy that uses various indicators to determine when to buy and sell a particular asset. Here's a breakdown of how the strategy works:
Timeframe: The strategy operates on a 15-minute timeframe, meaning it analyzes price data in 15-minute intervals. Indicators: The strategy utilizes two indicators:
Relative Strength Index (RSI): It calculates the RSI indicator with a time period of 14 and assigns the result to the 'rsi' column in the dataframe.
Bollinger Bands: It calculates the Bollinger Bands indicator with a window of 20 and a standard deviation of 2.
The lower, middle, and upper bands are assigned to the 'bb_lowerband', 'bb_middleband', and 'bb_upperband' columns, respectively.
Buy Condition: The strategy determines the buy signal based on the following conditions:
If the RSI is above 35 and the closing price is below the lower Bollinger Band, or
If the RSI is below 62 and the closing price is below the middle Bollinger Band. The strategy assigns a value of 1 to the 'buy' column in the dataframe when these conditions are met. Sell Condition: The strategy determines the sell signal based on the following condition:
No specific condition is specified in the provided code, as the line that potentially triggers the sell condition is commented out. This means that the strategy does not actively generate sell signals based on the RSI or Bollinger Bands in the given implementation. Take Profit and Stop Loss: The strategy defines a minimal return on investment (ROI) for each holding period. The defined ROI levels are as follows:
Hold for 0 minutes (immediate): 0.95% ROI
Hold for 2,880 minutes (2 days): 0.50% ROI
Hold for 4,320 minutes (3 days): 0.40% ROI
Hold for 5,760 minutes (4 days): 0.30% ROI
Hold for 7,200 minutes (5 days): 0.20% ROI
Hold for 10,080 minutes (7 days): 0.10% ROI
Stop Loss: The strategy employs a fixed stop loss at -0.99, meaning if the current profit of a trade reaches or falls below -99%, it triggers a stop loss and sells the asset. Custom Stop Loss: The strategy defines a custom stop loss function, which overrides the fixed stop loss. The custom stop loss function calculates the stop loss level dynamically based on the current profit of a trade. It sets different stop loss levels depending on the current profit percentage, gradually reducing the stop loss level as the profit percentage decreases. Note: The provided code is incomplete and lacks a specific sell condition. It is essential to carefully review and test the strategy before using it for live trading.