Linear Regression Candles

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #229802 quote
    brian gilbertbrian gilbert
    Participant
    Senior

    Hi, i found this code on web… i think that it’s a Pine Script code and i would know, if it’s possible, the translation for Probuilder.
    Thank you very much for helping.

    //@version=4
    study(title=”Humble LinReg Candles”, shorttitle=”LinReg Candles”, format=format.price, precision=4, overlay=true)

    signal_length = input(title=”Signal Smoothing”, type=input.integer, minval = 1, maxval = 200, defval = 11)
    sma_signal = input(title=”Simple MA (Signal Line)”, type=input.bool, defval=true)

    lin_reg = input(title=”Lin Reg”, type=input.bool, defval=true)
    linreg_length = input(title=”Linear Regression Length”, type=input.integer, minval = 1, maxval = 200, defval = 11)

    bopen = lin_reg ? linreg(open, linreg_length, 0) : open
    bhigh = lin_reg ? linreg(high, linreg_length, 0) : high
    blow = lin_reg ? linreg(low, linreg_length, 0) : low
    bclose = lin_reg ? linreg(close, linreg_length, 0) : close

    r = bopen < bclose

    signal = sma_signal ? sma(bclose, signal_length) : ema(bclose, signal_length)

    plotcandle(r ? bopen : na, r ? bhigh : na, r ? blow: na, r ? bclose : na, title="LinReg Candles", color= color.green, wickcolor=color.green, bordercolor=color.green, editable= true)
    plotcandle(r ? na : bopen, r ? na : bhigh, r ? na : blow, r ? na : bclose, title="LinReg Candles", color=color.red, wickcolor=color.red, bordercolor=color.red, editable= true)

    plot(signal, color=color.white)

    #229830 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Ecco cosa hai:

    //PRC_Linear Regression Candles
    //version = 0
    //15.03.24
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    ///////////////////////////////////////////////////////
    //------------------Inputs------------------------------
    signallength = 11 //integer//Signal Smoothing
    smasignal = 1 //boolean // Simple MA (Signal Line)
    linreg = 1 //boolean//Linear Regression
    linreglength = 11//integer//Linear Regression Length
    //------------------------------------------------------
    //-------------Candle definition------------------------
    if linreg then
    bopen = LinearRegression[linreglength](open)
    bhigh = LinearRegression[linreglength](high)
    blow = LinearRegression[linreglength](low)
    bclose = LinearRegression[linreglength](close)
    else
    bopen = open
    bhigh = high
    blow = low
    bclose = close
    endif
    //--------------------------------------------------------
    //--------------Color candles-----------------------------
    if bopen < bclose then
    r=0
    g=255
    else
    r=255
    g=0
    endif
    //---------------------------------------------------------
    //---------------Draw Candles------------------------------
    DRAWCANDLE(bopen, bhigh, blow, bclose)coloured(r,g,0)
    //---------------------------------------------------------
    //---------------Signal definition-------------------------
    if smasignal then
    signal = average[signallength](bclose)
    else
    signal = average[signallength,1](bclose)
    endif
    
    return signal as "Signal"coloured("white")style(line,2)
    #229864 quote
    brian gilbertbrian gilbert
    Participant
    Senior

    Wonderful, it works! You’re truly great, thank you very much…

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Linear Regression Candles


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by brian gilbertbrian gilbert
2 years, 6 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 03/14/2024
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...