The DIV_v1 trading strategy is designed to identify and exploit bullish divergence patterns in the market. Here's a breakdown of how the strategy works:
Timeframe and Data Requirements:
The strategy operates on 5-minute candlestick data. It requires a minimum of 200 startup candles for accurate analysis.
It processes only new candles, ignoring previously processed data.
Indicators:
Relative Strength Index (RSI): The strategy calculates the RSI with a time period of 14.
Divergence Detection:
The strategy employs a custom function called "divergence" to detect bullish divergence. Bullish divergence occurs when the price makes a lower low (LL) while the RSI makes a higher low (HL). The function marks the LL points on the price chart ("ohlc_bottom") and the corresponding HL points on the RSI chart ("rsi_bottom"). It then scans for instances where there is no conflicting price movement between the LL and HL points. If such conditions are met, the function identifies a bullish divergence and sets the "bullish_divergence" flag to True. Buy and Sell Conditions:
The strategy generates buy signals when the following conditions are met simultaneously:
Bullish divergence is detected (bullish_divergence == True). RSI is below 30. Volume is greater than 0. The strategy does not specify any sell conditions. Risk Management:
The strategy sets a minimal return on investment (ROI) of 5% ("minimal_roi") and a stop loss of -5% ("stoploss"). It enables trailing stop functionality, which dynamically adjusts the stop loss as the price moves favorably. The trailing stop starts at a positive offset of 0.001 and triggers the stop loss when the price retraces 2% from the highest point reached after triggering the stop loss. Visualization:
The strategy provides plot configurations to visualize the detected divergence and RSI values on the price and RSI charts, respectively. Please note that this is a brief summary of the DIV_v1 strategy, and for a comprehensive understanding, it's recommended to review the entire code and consult the strategy's author, Sanka.