Updated version of the strategy RSI Divergence with Trendline.
Calculates the RSI indicator using the specified settings Detects pivot points (highs and lows) in the RSI with a 5-period lookback Uses these pivots to identify four types of divergences: Regular bullish divergence: Price makes lower lows but RSI makes higher lows Hidden bullish divergence: Price makes higher lows but RSI makes lower lows Regular bearish divergence: Price makes higher highs but RSI makes lower highs Hidden bearish divergence: Price makes lower highs but RSI makes higher highs Creates dynamic trendlines on the RSI indicator Uses different colors to distinguish between divergence types: Green: Regular bullish divergence Blue: Hidden bullish divergence Red: Regular bearish divergence Orange: Hidden bearish divergence Automatically deletes and redraws trendlines when new divergences are detected Entry Signals Long entries: Triggered when RSI crosses above the bullish trendline Sets take profit price at entry price + 5% Sets stop loss price at entry price - 5% Short entries: Triggered when RSI crosses below the bearish trendline Sets take profit price at entry price - 5% Sets stop loss price at entry price + 5% Exit Rules Takes profit when price reaches the TP level Exits with a loss when price hits the SL level Additional exit conditions: Exits long positions when hidden bearish divergence appears Exits short positions when hidden bullish divergence appears Plots the RSI indicator in purple Shows overbought and oversold levels as horizontal lines Displays active take profit and stop loss levels with circular markers: Green circles for take profit levels Red circles for stop loss levels