Conversion régression linéaire Trading View en PRT

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #256706 quote
    Manu L.
    Participant
    Average

    Bonjour à tous,


    une âme charitable pour convertir ce code

    Merci 🙂


    //@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)



    #256728 quote
    Iván González
    Moderator
    Master

    Voici

    //---------------------------------------
    //PRC_Humble LinReg Candles (by ugurvu)
    //version = 0
    //23.01.2026
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //---------------------------------------
    // 0. Inputs
    //---------------------------------------
    linregLength=11
    linreg=1 // 1=True 0=False
    signalLength=11
    smasignal=1 // 1=True 0=False
    //---------------------------------------
    // 1. Calculate OHLC prices with Linear Regression if enabled
    //---------------------------------------
    IF linReg = 1 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
    //---------------------------------------
    // 2. Calculate Signal Line
    //---------------------------------------
    IF smaSignal = 1 THEN
       // Simple Moving Average
       signal = Average[signalLength](bClose)
    ELSE
       // Exponential Moving Average
       signal = ExponentialAverage[signalLength](bClose)
    ENDIF
    //---------------------------------------
    // 3. Drawing Candles
    //---------------------------------------
    // Green candles for bullish movements
    IF bOpen < bClose THEN
       DRAWCANDLE(bOpen, bHigh, bLow, bClose) COLOURED(0, 200, 0)
    ELSE
       // Red candles for bearish movements
       DRAWCANDLE(bOpen, bHigh, bLow, bClose) COLOURED(200, 0, 0)
    ENDIF
    //---------------------------------------
    RETURN signal AS "Signal Line" COLOURED("blue")
    


    Nicolas and Manu L. thanked this post
    #256729 quote
    Iván González
    Moderator
    Master

    Merci tout d’abord d’utiliser le moteur de recherche au cas où votre indicateur aurait déjà été traduit (https://www.prorealcode.com/prorealtime-indicators/linear-regression-candles/)

    Nicolas, robertogozzi and Manu L. thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Conversion régression linéaire Trading View en PRT


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Manu L. @manu-l Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Iván González
1 week, 4 days ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 01/22/2026
Status: Active
Attachments: No files
Logo Logo
Loading...