Convert Trading View Code to ProrealCode

Forums ProRealTime English forum ProBuilder support Convert Trading View Code to ProrealCode

Viewing 15 posts - 1 through 15 (of 23 total)
  • #228127

    hi

    where do i request or ask for help to convert trading view indicator code to pro-realtime code?

    below is the code that i like to convert. it is free indicator code on tradingview so not trying to get paid code from trading view to PRT. Credit for this code is to QUANTNOMAD. Indicator name on TV is UT Bot Alerts.

    Note – MOD – please delete if this is not allowed on this platform as i am new not sure of all rules. thanks.

     

    //@version=4
    study(title=”UT Bot Alerts”, overlay = true)
    // Inputs
    a = input(1,     title = “Key Vaule. ‘This changes the sensitivity'”)
    c = input(10,    title = “ATR Period”)
    h = input(false, title = “Signals from Heikin Ashi Candles”)
    xATR  = atr(c)
    nLoss = a * xATR
    src = h ? security(heikinashi(syminfo.tickerid), timeframe.period, close, lookahead = false) : close
    xATRTrailingStop = 0.0
    xATRTrailingStop := iff(src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), src – nLoss),
       iff(src<nz(xATRTrailingStop[1],0)andsrc[1]<nz(xATRTrailingStop[1],0),min(nz(xATRTrailingStop[1]),src+nLoss),
       iff(src > nz(xATRTrailingStop[1], 0), src – nLoss, src + nLoss)))
    pos = 0
    pos :=   iff(src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0), 1,
       iff(src[1]>nz(xATRTrailingStop[1],0)andsrc<nz(xATRTrailingStop[1],0),-1,nz(pos[1],0)))
    xcolor=pos==-1?color.red:pos==1?color.green:color.blue
    ema   = ema(src,1)
    above = crossover(ema, xATRTrailingStop)
    below = crossover(xATRTrailingStop, ema)
    buy  =src>xATRTrailingStopandabove
    sell = src < xATRTrailingStop and below
    barbuy  =src>xATRTrailingStop
    barsell=src<xATRTrailingStop
    plotshape(buy,  title = “Buy”,  text = ‘Buy’,  style = shape.labelup,   location = location.belowbar, color= color.green, textcolor = color.white, transp = 0, size = size.tiny)
    plotshape(sell, title = “Sell”, text = ‘Sell’, style = shape.labeldown, location = location.abovebar, color= color.red,   textcolor = color.white, transp = 0, size = size.tiny)
    barcolor(barbuy  ? color.green : na)
    barcolor(barsell ? color.red   : na)
    alertcondition(buy,  “UT Long”,  “UT Long”)
    alertcondition(sell, “UT Short”, “UT Short”)
    #228139

    Hi,
    I’ll try to convert it. Please be pacient because there are a lot of codes to translate ;

    #228141

    I can see that your code has already been translate.
    https://www.prorealcode.com/topic/ut-bot-alerts-2/

    1 user thanked author for this post.
    #228143

    THank you.

    However, I don’t think the code is converted correctly. If you read the thread then nicolas did his own version but not the exactly a conversion as requested in the thread.

    #228146

    See below,  I copied entire code from Trading view to PRT but getting error on defining variable H and then next variable title “xATR”.

     

    you can copy below code and tried to correct it if possible. thanks.

     

    #228148

    It’s a complete different language, it can’t be corrected. It needs to be converted (translated) to another language.

     

    #228198

    Thanks. I understand it is different language that is why i am seeking help to see anyone here knows or can convert this to PRT code.

    The purpose of copying into PRT format was that reader of this post can read it clearly.

    #228210

    Undrestood. I know there’s a conversion list.

     

    #228226

    Here it is:

    3 users thanked author for this post.
    #228329

    Thank you for the great effort.

    There is slight variation between your code and the one the trading view platform and it could be because the code that I gave above didn’t define Variable ” h ” (if you look at the line no. 8 in my above post #228146).

     

    Trading view defines h as below:

    h = input(false, title = “Signals from Heikin Ashi Candles”)
    which means signals are taken from Heikin Ashi candles while in your code signals are taken from candlesticks.
    in addition line number 15 in your code above has src = close but in trading view src defined again something from Heikin ashi as below :
    src = h ? security(heikinashi(syminfo.tickerid), timeframe.period, close, lookahead = false) : close
    is there a way to get signals from Heikin Ashi candles similar to code on TV ?
    #229585

    @JC_Bywan

    Ivan, already converted majority of the code I gave above in #228146 ,however we still don’t have solution to small item i talked in my post #228329 which is resulting in error/incorrect output when using this code in PRT.

    are you able to help?

     

    Thanks,

    #229591

    Hi
    You only have to write this instead line 15 and it will work also with Heikin Ashi candles:

    #229599

    Ivan

    Thanks, I updated the code as below. However, there are few issues as below (refer to the screenshot as well).

    1. In the setting, when I change the key value & ATR period then there is no change in the Green & Red Arrow Indicator Arrow on the chart. Which is not correct as the location of the indicator should change with change in the ATR period or Key value.
    2. As per the screen shot, “Signals from Heikin Ashi Candles” not active and as you can see in the screenshot it says “Variable not used in the code”.

    See below, I copied updated code so you can test it at your end as well. I used ticker code  ” WBC ” in the screenshot but the result is same across all ticker code i use from Australia.

     

     

    #229602

    Hi,
    I think you are working with previous .itf …
    Please, create new indicator, copy the code below and define again input variables or download the attached file.

    1 user thanked author for this post.
    #229621

    Ivan

     

    Thank you. I created new indicator by copying your code above but it didn’t work so then I copied your itf file and imported into my system and it worked. so it did work using the file you sent through but somehow copying code is not working… !

    Somehow, the signal I got on PRT are more then what the code should be giving if it was same as what is on Trading view. See attached image, the bottom part of the image is trading view which gave 4 signals and top part is from PRT using your new code and it gave 6 signals. Two extra signals are highlighted in circle on the top part of the chart.

    In addition signal number 1 on PRT is completely different date to what we have on trading view.

    i checked on different other tickers and same thing happened as here. more signals are coming out of PRT code then what we get from tradingview code. not sure why it is happening, but PRT is giving false signals which is the issue as too many early buy & sell signals comes out of PRT thn trading view for the same setting.

Viewing 15 posts - 1 through 15 (of 23 total)

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