BUY/SELL RSI FLIUX v1.0
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © vladimir5738

//@version=5
indicator("BUY/SELL RSI FLIUX v0.1", shorttitle="BSRSIFLUX", overlay=true)

// Уровни поддержки и сопротивления
lengthSR = 14 // Количество баров для определения уровней
highestHigh = ta.highest(high, lengthSR)
lowestLow = ta.lowest(low, lengthSR)

// RSI
lengthRSI = 9 // Количество баров для расчета RSI
rsiValue = ta.rsi(close, lengthRSI)
rsiOverbought = 70
rsiOversold = 30

// Построение уровней поддержки и сопротивления
plot(highestHigh, "Resistance", color=color.red)
plot(lowestLow, "Support", color=color.green)

// Условия для сигналов на основе RSI
longCondition = rsiValue < rsiOversold and close > lowestLow
shortCondition = rsiValue > rsiOverbought and close < highestHigh

// Отображение меток купли/продажи
plotshape(series=longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")

plot(close)

