Advanced RSI Helper

Here is Advanced RSI Helper. An advanced RSI represented in a candle type chart. It contains a Stochastic Bands, a Pivot Detector (High-Low) and an efficient RSI divergences. You also have the option of placing alerts for Divergences or when the RSI exceeds the Upper zone 1/2 or Lower zone 1/2.

Advanced RSI Helper in action on Nasdaq Index.

Screenshot taken from the Settings menu of Advanced RSI helper Helper.

Here is the complete list of features present in this indicator :

  • Stochastic Bands
  • Pivots
  • RSI Divergences

All indicators have their original default settings. You need to be able to readjust them depending on the market instrument you want to analyze. You have the possibility to put alerts which will notify you when an indicator gives a new signal. When placing an alert, be sure to choose the “once per bar” option each time you place an alert.

Rate this Indicator?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this Indicator.

5
(1)

Or copy / paste the source code into your pine editor :

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RickSimpson
//@version=4

study(title="Advanced RSI Helper", precision=1)

//Inputs

showstoch    =input(defval=false,   title="Show Stochastic?")
showpiv      =input(defval=false,   title="Show Pivots?")
showdiv      =input(defval=true,    title="Show Divergences?")
rsilen       =input(defval=14,      title="RSI Length",                            minval=1)
rsismooth    =input(defval=1,       title="RSI Smooth",        type=input.integer, minval=1)
stochsrc     =input(defval="close", title="Stochastic Source", options=["open","high","low","close","hl2","hlc3","ohlc4"])
stochlen     =input(defval=14,      title="Stochastic Length", type=input.integer, minval=1)
stochklen    =input(defval=3,       title="Stochastic K",      type=input.integer, minval=1)
stochdlen    =input(defval=3,       title="Stochastic D",      type=input.integer, minval=1)

//Settings

rsion         = true
pivrb         = 3
pivlb         = 8
pivloopback   = 50
pivlbm        = 75
pivlbmx       = 25
chart_type_is = "Candles"
cbc_b         = #67ac5b
cbrc_b        = #67ac5b
cwkc_b        = #67ac5b
cbc_s         = #d63964
cbr_s         = #d63964
cwkc_s        = #d63964

rsi_config() =>
	o=sma(rsi(open,  rsilen), rsismooth)
	h=sma(rsi(high,  rsilen), rsismooth)
	l=sma(rsi(low,   rsilen), rsismooth)
	c=sma(rsi(close, rsilen), rsismooth)
	
	[o, h, l, c]

[_open, _thigh, _tlow, _close] = rsi_config()

_high = max(_open, _thigh, _tlow, _close)
_low  = min(_open, _thigh, _tlow, _close)

float __open  = _open
float __high  = _high
float __low   = _low
float __close = _close

if (rsion and chart_type_is == "Siwi Candles")
    float wsu  = na
    float lwsl = na
    hls = _high - _low
    
    if (_open < _close)
        wsu  := _high - _close
        lwsl := _open - _low

    else if (_open > _close)
        wsu  := _high - _open
        lwsl := _close - _low

    nwk = abs(wsu - lwsl)
    
    __high := if (_open < _close)
        if(wsu > lwsl)
            _close + nwk
        else
            _close
    
    else if (_open > _close)
        if(wsu > lwsl)
            _open + nwk
        else
            _open

    __low := if (_open < _close)
        if (wsu < lwsl)
            _open - nwk
        else 
            _open
    
    else if (_open > _close)
        if (wsu < lwsl)
            _close - nwk
        else 
            _close

else if (rsion and chart_type_is == "Heikin Ashi")
    __close := (_open + _high + _low + _close) / 4
    __open  := (_open + __close)[1] / 2
    __high  := max(__open, _high, __close)
    __low   := min(__open, _low,  __close)

else if (rsion and chart_type_is == "HL Bar")
    if (_close > _open or _close == _open)
        __open  := _low
        __close := _high
    else
        __open  := _high
        __close := _low

float _hl2_   = (__high + __low) / 2
float _hlc3_  = (__high + __low +  __close) / 3
float _ohlc4_ = (__open + __high + __low + __close) / 4

//Calculation

f_src(src) =>
     src == "open"  ?
     __open :
     src == "high"  ?
     __high :
     src == "low"   ?
     __low :
     src == "close" ?
     __close :
     src == "hl2"   ?
     _hl2_ :
     src == "hlc3"  ?
     _hlc3_ :
     src == "ohlc4" ?
     _ohlc4_ : na

float stochK = na
float stochD = na

if (showstoch)
    stochK := sma(stoch(f_src(stochsrc), __high, __low, stochlen), stochklen)
    stochD := sma(stochK, stochdlen)

hpivsrc = max(__open, __high, __low, __close)
lpivsrc = min(__open, __high, __low, __close)

if (chart_type_is == "Line")
    hpivsrc := __close
    lpivsrc := __close
    
hpv = pivothigh(hpivsrc, pivlb, pivrb)
lpv = pivotlow(lpivsrc,  pivlb, pivrb)

div_config   = if (showdiv)
    plp      = valuewhen(lpv, lpv, 1)
    php      = valuewhen(hpv, hpv, 1)
    plpof    = barssince((not na(lpv))[1])
    phpof    = barssince((not na(hpv))[1])
    hltrack  = (lpv > plp) and (pivlbmx > plp)
    lhtrack  = (hpv < php) and (pivlbm  < php)
    plprice  =  low[pivrb]
    phprice  = high[pivrb]
    pvlprice = valuewhen(lpv, low[pivrb],  1)
    pvhprice = valuewhen(hpv, high[pivrb], 1)
    pll      = plprice < pvlprice
    phh      = phprice > pvhprice
    
    if(hltrack and pll and (plpof <= pivloopback) and (plpof >= 3)) 
        "bullish"
    else if(lhtrack and phh and (phpof <= pivloopback) and (phpof >= 3))
        "bearish"
    else 
        na

//Plotting

k = plot(showstoch ? stochK : na, color=stochK > stochD ? cbrc_b : stochK < stochD ? cbc_s : color.white, transp=50)
d = plot(showstoch ? stochD : na, color=stochK > stochD ? cbrc_b : stochK < stochD ? cbc_s : color.white, transp=50)
fill(k, d, stochK  > stochD ? cbrc_b : stochK < stochD ? cbc_s : color.white, title="Stochastic")
plotcandle(rsion and chart_type_is != "Hollow Candles" and chart_type_is != "Line" and __open < __close ? __open : na, __high, __low, __close, color=cbc_b, bordercolor=cbrc_b, wickcolor=cwkc_b,  editable=false) 
plotcandle(rsion and chart_type_is != "Hollow Candles" and chart_type_is != "Line" and __open > __close ? __open : na, __high, __low, __close, color=cbc_s, wickcolor=cwkc_s,   bordercolor=cbr_s, editable=false)
plotcandle(chart_type_is == "Hollow Candles" and __close >= __close[1] ? __open : na, __high, __low, __close, color=__close < __open ? cbc_b : na, wickcolor=cwkc_b, bordercolor=cbrc_b, editable=false) 
plotcandle(chart_type_is == "Hollow Candles" and __close  < __close[1] ? __open : na, __high, __low, __close, color=__close < __open ? cbc_s : na, wickcolor=cwkc_s, bordercolor=cbr_s, editable=false)
plotchar(showpiv or (showdiv and div_config == "bearish") ? hpv + 5 : na, char="↓", location=location.absolute, color=#d63964, offset=-pivrb, editable=false, size=size.tiny)
plotchar(showpiv or (showdiv and div_config == "bullish") ? lpv - 5 : na, char="↑", location=location.absolute, color=#67ac5b, offset=-pivrb, editable=false, size=size.tiny)
plot(showdiv ? hpv : na, linewidth=2, color=div_config == "bearish" ? #d63964 : na, offset=-pivrb, editable=false)
plot(showdiv ? lpv : na, linewidth=2, color=div_config == "bullish" ? #67ac5b : na, offset=-pivrb, editable=false)
hline(70, title="First Upper Zone",  linestyle=hline.style_dotted, color=#da4f7a)
hline(80, title="Last Upper Zone",   linestyle=hline.style_dotted, color=#da4f7a)
hline(50, title="Center Zone",       linestyle=hline.style_dotted, color=#88898b)
hline(30, title="First Lower Zone ", linestyle=hline.style_dotted, color=#5ca4ef)
hline(20, title="Last Lower Zone",   linestyle=hline.style_dotted, color=#5ca4ef)

//Alerts

alertcondition(div_config == "bearish", title="RSI Bearish Divergence",   message='RSI Bearish Divergence')
alertcondition(div_config == "bullish", title="RSI Bullish Divergence",   message='RSI Bullish Divergence')
alertcondition(_close >= 70,            title="First Upper Zone Reached", message='First Upper Zone Reached')
alertcondition(_close >= 80,            title="Last Upper Zone Reached",  message='Last Upper Zone Reached')
alertcondition(_close <= 30,            title="First Lower Zone Reached", message='First Lower Zone Reached')
alertcondition(_close <= 20,            title="Last Lower Zone Reached",  message='Last Lower Zone Reached')

The content covered on this website is NOT investment advice and I am not a financial advisor.