Rainbow Collection - Blue
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Sofien-Kaabar

//@version=5
indicator("Rainbow Collection - Blue", overlay = true)

lookback     = input(defval = 21, title = 'Lookback')
lookback_rsi = input(defval = 21, title = 'RSI Lookback')

slope      = (close - close[lookback]) / lookback
indicator  = ta.rsi(slope, lookback_rsi)

buy  = indicator > 30 and indicator[1] < 30 and indicator < 35
sell = indicator < 70 and indicator[1] > 70 and indicator > 65

plotshape(buy,  style = shape.triangleup,   color = color.blue,  location =  location.belowbar, size = size.small)
plotshape(sell,  style = shape.triangledown, color = color.blue,    location =  location.abovebar, size = size.small)
