Conversion of Linear Channels indicator from TradingView

Forums ProRealTime English forum ProBuilder support Conversion of Linear Channels indicator from TradingView

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

    Hello,

    I’m interested if its possible to convert this indicator from TradingView and import it into ProRealTime.

    On this indicator the length parameter controls how long the lines are like with Moving Average, mult controls how the line fits to the price but can affect the length and channel spread, spread value changes the channel spread like the Envelopes indicator.
    The indicator can have some issues on TradingView where larger price values will require to use lower length and higher mult instead, so the point parameter is used to fix the indicator when using it on high market price values or when the indicator exhibits a weird behaviour.
    Lastly the extrapolate parameter is there to show possible future price positions respective to the channels.

    All info is in the original post:
    https://www.tradingview.com/script/J4ccCRMW-Linear-Channels/

    Thank you.

     

    //@version=4
    study("Linear Channels",overlay=true)
    length = input(14),mult=input(50),spread = input(1,"Channels Spreading"),point = input(false),extrapolate = input(true)
    //----
    a = 0.
    s = point ? syminfo.pointvalue*10*(1/length) : syminfo.mintick*100*(1/length)
    x = open + change(nz(a[1],open))*mult
    a := x > nz(a[1],x) + s ? nz(a[1],x) + s : x < nz(a[1],x) - s ? nz(a[1],x) - s : nz(a[1],x)
    //----
    upper = 0.
    lower = 0.
    Up = a + abs(change(a))*(mult*spread)
    Dn = a - abs(change(a))*(mult*spread)
    upper := Up == a ? nz(upper[1]) : Up
    lower := Dn == a ? nz(lower[1]) : Dn
    //----
    n = bar_index
    if barstate.islast and extrapolate == true
    line A = line.new(n[1],upper[1],n,upper,extend=extend.right,color=#0080FF,style=line.style_dashed,width=2)
    line B = line.new(n[1],a[1],n,a,extend=extend.right,color=#e65100,style=line.style_dashed,width=2)
    line C = line.new(n[1],lower[1],n,lower,extend=extend.right,color=#ff1100,style=line.style_dashed,width=2)
    line.delete(A[1])
    line.delete(B[1])
    line.delete(C[1])
    plot(upper,color=#0080FF,linewidth=2,transp=0)
    plot(a,color=#e65100,linewidth=2,transp=0)
    plot(lower,color=#ff1100,linewidth=2,transp=0)

    #195186

    Thank you for the well formatted translation code query. I will look at that today.

    #195190

    You know that this indicator is continuously repainting right? It deletes previous lines in order to make the new ones fit the past with new prices. Since we can’t delete previously plotted graphical objects in ProBuilder, it would take a lot of work to make it looks the same by using arrays and plotting all objects in the past from the current candlesticks.

    Are you sure you want it to be converted as it is useless in real time trading? As the author suggest, a classic Linear Regression would fit perfectly if you want to use channel in your trading.

    #195204

    Thank you for taking the time to look at this, I am aware of how it works and I still found uses for it.
    I’m not looking to waste anyone’s time so if it’s too much work as you said then the conversion won’t be necessary.

    #195213

    Ok, so you’ll get the same exact behavior with this indicator by choosing a lookback of 50 bars period like in the original indicator: Standard Deviation & Standard Error Linear Regression Channel

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