Rsi cycle indicator converted in pro real-time from tradingviiew codee

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #206475 quote
    yas
    Participant
    Junior

    //@version=3

    study(“Better RSI”)

    cycler = na

    myPeriod = input(defval = 14, type=integer, title=”Period”)

    src = input(close, type=source)

    showCycler = input(true,’Show cycler?’)

    lvl = input(50, ‘Cycler level on plot’)

    myRSI = rsi(src, myPeriod)

    firstcolor = color(white,10)

    secondcolor = color(orange,50)

    thirdcolor = gray

     

    h30 = hline(30,color=firstcolor,linestyle=dashed,title=’Low’)

    h70 = hline(70,color=firstcolor,linestyle=dashed,title = ‘High’)

    h20 = hline(20, color=secondcolor,linestyle = solid,title=’Second low’)

    h80 = hline(80, color=secondcolor,linestyle=solid,title=’Second high’)

    //h50 = hline(50, color=orange, title= ‘Mid line’)

    h40 = hline(40, color = thirdcolor, linestyle = dashed,title = ’40 line’)

    h60 = hline(60, color = thirdcolor, linestyle = dashed, title = ’60 line’)

    //fill(h30,h20,red,transp=80, title=’Oversold color’)

    //fill(h80,h70,red,transp=80, title=’Overbought color’)

    fill(h30,h70,fuchsia,transp=90, title= ‘Background color’)

    //cond =? red:white

    RSIplot = plot(myRSI,color=white,linewidth=2,transp=0,title=”RSI”)

    plot(myRSI >= 70 or myRSI<= 30? myRSI:na,style = linebr,linewidth=3,color=red,transp = 0, title = ‘Oversold color’)

     

    //cycler

    cycler := if myRSI > 69 or myRSI< 31

    a = if myRSI > 69

    1 // bullish

    else

    2 // bearish

    a

    else

    b = if (nz(cycler[1]) == 1 and myRSI < 39) or (nz(cycler[1]) == 2 and myRSI > 61)

    0

    else

    nz(cycler[1])

    b

     

     

    mycolor = if cycler == 0

    white

    else

    c = if cycler == 1

    lime

    else

    red

    c

     

    plot(showCycler? lvl:na, style = line, color = mycolor, transp = 30, linewidth=2, title = ‘Cycler colors’)

    #206566 quote
    yas
    Participant
    Junior

    Is it possible that we can get the above code converted, please

    #206580 quote
    yas
    Participant
    Junior

    Can someone help me convert this into pro real time please 🙏

    #206660 quote
    Nicolas
    Keymaster
    Master

    Sorry but I didn’t want to be late at new year’s party, so I postponed your request 😆

    Here is the translated code for the BetterRSI code you submit:

    //Better RSI
    
    myPeriod = 14 //Period
    showCycler = 1 //1=true; Show cycler?
    lvl = 50 //Cycler level on plot
    // ---
    
    src = customclose
    myRSI = rsi[myPeriod](src)
    
    cycler = undefined
    
    COLORBETWEEN(70,30,"Fuchsia",90) 
    
    if showcycler then 
    if myRSI > 69 or myRSI< 31 then 
    if myRSI > 69 then 
    cycler = 1
    else 
    cycler= 2
    endif
    else
    if (cycler[1] = 1 and myRSI < 39) or (cycler[1] = 2 and myRSI > 61) then 
    cycler = 0
    else
    cycler = cycler[1]
    endif
    endif
    
    if cycler = 1 then 
    r= 0
    g=255
    b=0
    elsif cycler=2 then 
    r=255
    g=0
    b=0
    else
    r=168
    g=168
    b=168
    endif 
    endif 
    
    
    return myrsi style(line,2)as "RSI", 50 style(line,2) coloured(r,g,b) as "cycler", 30 style(dottedline) as "Low", 70 style(dottedline) as "High", 20 style(line) as "Second low", 80 style(line) as "Second high", 40 style(dottedline) as "40 line", 60 style(dottedline) as "60 line"
    
    #206670 quote
    yas
    Participant
    Junior

    Thanks mate much appreciated and happy new year

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Rsi cycle indicator converted in pro real-time from tradingviiew codee


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
yas @yas Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by yas
3 years, 1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 12/29/2022
Status: Active
Attachments: No files
Logo Logo
Loading...