Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © santanudas2002
- //@version=5
- indicator("RSI Heiken Ashi Candles", precision = 2)
- rsiPeriod = input.int(14, "RSI Period", minval = 1)
- inp = input(close)
- rsiOpen = ta.rsi(open, rsiPeriod)
- rsiHigh = ta.rsi(high, rsiPeriod)
- rsiLow = ta.rsi(low, rsiPeriod)
- rsiClose= ta.rsi(inp, rsiPeriod)
- rsiOpenha = (rsiOpen[1] + rsiClose[1]) / 2
- rsiHighha = math.max(rsiHigh, rsiOpen, rsiClose)
- rsiLowha = math.min(rsiLow, rsiOpen, rsiClose)
- rsiCloseha = (rsiOpen + rsiHigh + rsiLow + rsiClose) / 4
- rsiColor = rsiCloseha > rsiOpenha ? #22AB94 : #F7525F
- plotcandle(rsiOpenha, rsiHighha, rsiLowha, rsiCloseha, "RSI Candle", rsiColor, rsiColor, bordercolor = rsiColor)
- upper60 = hline(60, "First Over Bought", color.gray, hline.style_dashed, 1)
- middle = hline(50, "Middle", color.gray, hline.style_solid, 1)
- lower40 = hline(40, "First Over Sold", color.gray, hline.style_dashed, 1)
- upper80 = hline(80, "Extreme Over Bought", #F76002, hline.style_dashed, 1)
- lower20 = hline(20, "Extreme Over Sold", #22AB94, hline.style_dashed, 1)
- fill(upper60, lower40, color = color.new(#FDFEFF, 85), title = "Neutral Region")
- fill(upper80, upper60, color = color.from_gradient(rsiCloseha, 60, 80, color.new(#F76002, 85), color.new(#F76002, 55)), title = "Overbought Region")
- fill(lower20, lower40, color = color.from_gradient(rsiCloseha, 20, 40, color.new(#22AB94, 55), color.new(#22AB94, 85)), title = "Oversold Region")
Advertisement
Add Comment
Please, Sign In to add comment