Professional Documents
Culture Documents
// Inputs
length = input(14, title="Period")
rsiLength = input(14, title="RSI Length")
rsiOversold = input(70, title="RSI Oversold")
rsiOverbought = input(30, title="RSI Overbought")
// Calculations
price = close
emaUp = ta.ema(price, length)
emaDown = ta.ema(price, length * 2)
rsi = ta.rsi(close, rsiLength)
// Breakout conditions
isUpBreakout = price > resistance and price[1] <= resistance
isDownBreakout = price < support and price[1] >= support
// Plot lines
plot(emaUp, color=color.blue, linewidth=2, title="Upper Line")
plot(emaDown, color=color.red, linewidth=2, title="Lower Line")
// Plot labels
plotshape(isUpBreakout ? bar_index : na, style=shape.triangleup, color=color.green,
text="B", size=size.small)
plotshape(isDownBreakout ? bar_index : na, style=shape.triangledown,
color=color.red, text="B", size=size.small)
plotshape(price >= resistance ? bar_index : na, style=shape.labelup,
color=color.gray, text="R", size=size.small)
plotshape(price <= support ? bar_index : na, style=shape.labeldown,
color=color.gray, text="S", size=size.small)