Rainbow Collection - Violet
// 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 - Violet", overlay = true)

psar = ta.sar(0.01, 0.02, 0.2)

buy  = close > ta.hma(close, 20) and close[1] < ta.hma(close, 20)[1] and close[2] < ta.hma(close, 20)[2] and close[3] < ta.hma(close, 20)[3] and close[5] < ta.hma(close, 20)[5] and close[8] < ta.hma(close, 20)[8] and close[13] < ta.hma(close, 20)[13] and close[21] < ta.hma(close, 20)[21]
sell = close < ta.hma(close, 20) and close[1] > ta.hma(close, 20)[1] and close[2] > ta.hma(close, 20)[2] and close[3] > ta.hma(close, 20)[3] and close[5] > ta.hma(close, 20)[5] and close[8] > ta.hma(close, 20)[8] and close[13] > ta.hma(close, 20)[13] and close[21] > ta.hma(close, 20)[21]

plotshape(buy and buy[1] == 0,  style = shape.triangleup,   color = color.rgb(127, 0, 255),  location =  location.belowbar, size = size.small)
plotshape(sell and sell[1] == 0,  style = shape.triangledown, color = color.rgb(127, 0, 255),  location =  location.abovebar, size = size.small)
