Stochastic RSI Crossover

Forums ProRealTime English forum ProBuilder support Stochastic RSI Crossover

Viewing 5 posts - 1 through 5 (of 5 total)
  • #113717

    The indicator gives a dot in the indicator window when the rsi k line crosses up the 70 or down the 30 into overbought or oversold.

    ——————————————————————————————–

    //@version=3

    study(“Stochastic RSI”, shorttitle=”Stoch RSI Crossovers”, overlay=false)

    /////////////////////////////////////////////////
    ///// Variables and Inputs /////
    /////////////////////////////////////////////////

    // Define The Variables //
    V = volume
    O = open
    H = high
    L = low
    C = close

    srcSelect = input(title = “Select the Stochastic RSI Source”, defval = “Close”, options=[“Open”, “High”, “Low”, “Close”, “Volume”, “HL/2”, “HLC/3”, “OHLC/4″])
    src = iff(srcSelect==”Open”, O, iff(srcSelect==”High”, H, iff(srcSelect==”Low”, L, iff(srcSelect==”HL/2″, hl2, iff(srcSelect==”HLC/3″, hlc3, iff(srcSelect==”OHLC/4″, ohlc4, iff(srcSelect==”Volume”, V, C)))))))
    len = input(title = “Select the Stochastic RSI Length”, defval = 14, minval = 1, step = 1)
    stochK = input(title = “Select the %K Time Period (Orange)”, defval = 3, minval = 1, step = 1)
    stochD = input(title = “Select the %D Time Period (Blue)”, defval = 3, minval = 1, step = 1)
    checkOBPlot = input(title = “Plot the Overbought Crosses?”, defval = true)
    overSold = input(title = “Select the Overbought Level”, defval = 80, minval = 1, step = 1)
    checkOSPlot = input(title = “Plot the Oversold Crosses?”, defval = false)
    overBought = input(title = “Select the Oversold Level”, defval = 20, minval = 1, step = 1)

    /////////////////////////////////////////////////
    ///// Stochastic RSI Calc /////
    /////////////////////////////////////////////////

    sRSI = rsi(src, len)
    k = sma(stoch(sRSI, sRSI, sRSI, len), stochK)
    d = sma(k, stochD)

    /////////////////////////////////////////////
    ///// Plots and Plot Conditions /////
    /////////////////////////////////////////////

    plot(k, title=”Stochastic RSI K% Line”, color = orange, style = line, linewidth=1)
    plot(d, title=”Stochastic RSI D% Line”, color = blue, style = line, linewidth=1)

    oSoldLine = hline(overSold, title=’Oversold’, color=gray, linestyle=dotted, linewidth=1)
    oBoughtLine = hline(overBought, title=’Overbought’, color=gray, linestyle=dotted, linewidth=1)
    fill(oSoldLine, oBoughtLine, color=gray, transp=80)

    kCrossOver = crossover(k, overSold)
    dCrossOver = crossover(d, overSold)

    kCrossUnder = crossunder(k, overBought)
    dCrossUnder = crossunder(d, overBought)

    plotshape(checkOBPlot and kCrossOver ? k : na, title=”K% Overbought”, color=green, style=shape.circle, location=location.absolute, size=size.tiny, transp=50)
    plotshape(checkOBPlot and dCrossOver ? d : na, title=”D% Overbought”, color=red, style=shape.circle, location=location.absolute, size=size.tiny, transp=50)

    plotshape(checkOSPlot and kCrossUnder ? k : na, title=”K% Oversold”, color=green, style=shape.circle, location=location.absolute, size=size.tiny, transp=50)
    plotshape(checkOSPlot and dCrossUnder ? d : na, title=”D% Oversold”, color=red, style=shape.circle, location=location.absolute, size=size.tiny, transp=50)

    alertcondition(kCrossOver, title=”K% Overbought Alert”, message=”K% Crossed Into Overbought”)
    alertcondition(dCrossOver, title=”D% Overbought Alert”, message=”D% Crossed Into Overbought”)
    alertcondition(kCrossOver, title=”K% Oversold Alert”, message=”K% Crossed Into Oversold”)
    alertcondition(dCrossOver, title=”D% Oversold Alert”, message=”D% Crossed Into Oversold”)

    #113718

    Forgot to mention that this comes from Tradingview….

    #113737

    Please post a screenshot and follow the rules to ask code conversion next time: Ask for a free code conversion

    #113739

    My apologies . First time here lol. I thought I had attached some screen shots but that went a bit wrong apparently.

    Let me try that again.

    #113944

    Hi Nicolas, just to make sure I understand  correctly. Would like me to open a new request or can we work with this one?

     

Viewing 5 posts - 1 through 5 (of 5 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login