Nothing Special   »   [go: up one dir, main page]

Reversion Zone Index by Profitprotrading

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

// This source code is subject to the terms of the Mozilla Public License 2.

0 at
https://mozilla.org/MPL/2.0/
// © profitprotrading
//@version=5
indicator(title='Reversion Zone Index', shorttitle='RZI', overlay=false, precision
= 0)

//CCI
lengthX = input.int(20, minval=1, group = "CCI")
srcX = input(hlc3, title="Source", group = "CCI")
maX = ta.sma(srcX, lengthX)
cci = (srcX - maX) / (0.015 * ta.dev(srcX, lengthX))
cci := cci/2

// Choppiness Index Calculation


length = input(14, 'CI Length', group = "Choppiness Index")
chopLength = input(14, 'Chop Length', group = "Choppiness Index")
ci = 100 * math.log10(math.sum(ta.atr(1), chopLength) / (ta.highest(chopLength) -
ta.lowest(chopLength))) / math.log10(chopLength)

//BB%
length1 = input.int(20, minval=1)
src = input(close, title="Source", group = "BB Percentile")
mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev", group = "BB
Percentile")
basis = ta.sma(src, length1)
dev = mult * ta.stdev(src, length1)
upper = basis + dev
lower = basis - dev
bbr = (src - lower)/(upper - lower)
bbr := bbr*80

comb = (ci + bbr) / 2


comb := comb*3

comb2 = (ci + cci + bbr)/3


combX = ta.ema(comb2, 10)

//Plotting
col = color.from_gradient(combX, 7, 60, color.rgb(0, 200, 7), color.rgb(222, 0, 0))
up = 60
dn = 10
up1 = plot(up, "Overbought", color = color.rgb(255, 255, 255))
dn1 = plot(dn, "Oversold", color = color.white)
mid = plot(33.5, display = display.none)
combX1 = plot(combX, linewidth = 4, color = col, style = plot.style_line)
plotshape(comb2 < -10, style = shape.triangleup, color = color.rgb(0, 235, 8),
location = location.bottom, size = size.tiny)
plotshape(comb2 > 70, style = shape.triangledown, color = color.rgb(255, 0, 0),
location = location.top, size = size.tiny)

fill(combX1, mid, 75, 40, top_color = color.new(#d50000, 0), bottom_color =


color.new(#000000, 100), title = "Overbought Gradient Fill")
fill(combX1, mid, 15, -5, top_color = color.new(#000000, 100), bottom_color =
color.new(#23bf00, 0), title = "Overbought Gradient Fill")

You might also like