Conversion of Dynamic Flow Ribbons from TradingView

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #248766 quote
    npam
    Participant
    New

    Hello,
    I need help to translate a such great indicator, that is not very easy to translate, please.
    Thanks

    // This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © BigBeluga

    //@version=6
    indicator(“Dynamic Flow Ribbons [BigBeluga]”, overlay = true)

    // INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{

    factor = input.float(3, “Length”, step = 0.01)

    col_up = input.color(color.rgb(26, 221, 127), “”, inline = “Col”)
    col_dn = input.color(color.rgb(231, 147, 20), “”, inline = “Col”)
    // }

    // CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
    float dist = ta.sma(high-low, 200)

    trend_line(factor)=>

    float src = hlc3
    int _direction = na
    float trend_line = na

    upperBand = ta.ema(src, 15) + factor * dist
    lowerBand = ta.ema(src, 15) – factor * dist
    prevLowerBand = nz(lowerBand[1])
    prevUpperBand = nz(upperBand[1])

    lowerBand := lowerBand > prevLowerBand or src[1] < prevLowerBand ? lowerBand : prevLowerBand upperBand := upperBand < prevUpperBand or src[1] > prevUpperBand ? upperBand : prevUpperBand

    prevTrendLine = trend_line[1]
    if na(dist[1])
    _direction := 1
    else if prevTrendLine == prevUpperBand
    _direction := src > upperBand ? -1 : 1
    else
    _direction := src < lowerBand ? 1 : -1 trend_line := _direction == -1 ? lowerBand : upperBand line_ = math.avg(lowerBand, upperBand) [line_, _direction, lowerBand, upperBand] [line_, _direction, lowerBand, upperBand] = trend_line(factor) // } // PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{ t_col = _direction == 1 ? col_dn : col_up plot(line_, "TrendLine", color = color.new(t_col, 0), linewidth = 4) plot(line_, "TrendLine", color = color.new(t_col, 80), linewidth = 10) plot(lowerBand+dist, "LowerBand1", color = _direction == -1 ? color.new(t_col, 80) : color.new(t_col, 100), linewidth = 1) plot(lowerBand+dist*0.5, "LowerBand2", color = _direction == -1 ? color.new(t_col, 60) : color.new(t_col, 100), linewidth = 1) plot(lowerBand, "LowerBand3", color = _direction == -1 ? color.new(t_col, 40) : color.new(t_col, 100), linewidth = 1) plot(lowerBand-dist*0.5, "LowerBand4", color = _direction == -1 ? color.new(t_col, 20) : color.new(t_col, 100), linewidth = 1) plot(lowerBand-dist, "LowerBand5", color = _direction == -1 ? color.new(t_col, 0) : color.new(t_col, 100), linewidth = 1) plot(upperBand+dist, "UpperBand5", color = _direction == 1 ? color.new(t_col, 0) : color.new(t_col, 100), linewidth = 1) plot(upperBand+dist*0.5, "UpperBand4", color = _direction == 1 ? color.new(t_col, 20) : color.new(t_col, 100), linewidth = 1) plot(upperBand, "UpperBand3", color = _direction == 1 ? color.new(t_col, 40) : color.new(t_col, 100), linewidth = 1) plot(upperBand-dist*0.5, "UpperBand2", color = _direction == 1 ? color.new(t_col, 60) : color.new(t_col, 100), linewidth = 1) plot(upperBand-dist, "UpperBand1", color = _direction == 1 ? color.new(t_col, 80) : color.new(t_col, 100), linewidth = 1) plotcandle(open, high, low, close, title='CandleStick Coloring', color = color.new(t_col, 50), wickcolor=color.new(t_col, 50), bordercolor = color.new(t_col, 50)) // }

    #248775 quote
    Iván González
    Moderator
    Master

    Ici vous avez :

    //---------------------------------------//
    //PRC_Dynamic Flow Ribbons by [BigBeluga]
    //version = 0
    //10.07.25
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //---------------------------------------//
    // --- Inputs
    //---------------------------------------//
    factor=3 // Length
    RcolorUp=26
    GcolorUp=221
    BcolorUp=127
    RcolorDn=231
    GcolorDn=147
    BcolorDn=20
    //---------------------------------------//
    // --- Calculations
    //---------------------------------------//
    dist = average[200,0](high-low)
    src=(high+low+close)/3
    once direction=1
    
    if barindex>=200 then
    
    lowerband=average[15,1](src)-factor*dist
    if lowerband>lowerband[1] or src[1]<lowerband[1] then
    lowerband=average[15,1](src)-factor*dist
    else
    lowerband=lowerband[1]
    endif
    
    upperband=average[15,1](src)+factor*dist
    If upperband<upperband[1] or src[1]>upperband[1] then
    upperband=average[15,1](src)+factor*dist
    else
    upperband=upperband[1]
    endif
    
    if trendline[1]=upperband[1] then
    if src>upperband then
    direction=-1
    else
    direction=1
    endif
    else
    if src<lowerband then
    direction=1
    else
    direction=-1
    endif
    endif
    if direction=-1 then
    trendline=lowerband
    r=rcolorUp
    g=gcolorUp
    b=bcolorUp
    alu=0
    alw=1
    else
    trendline=upperband
    r=rcolorDn
    g=gcolorDn
    b=bcolorDn
    alu=1
    alw=0
    endif
    iline=(lowerband+upperband)/2
    alpha=255
    else
    upperband=src
    lowerband=src
    iline=src
    alpha=0
    endif
    //---------------------------------------//
    // --- Ribbons
    //---------------------------------------//
    upperband1=upperband-dist
    upperband2=upperband-dist*0.5
    upperband3=upperband
    upperband4=upperband+dist*0.5
    upperband5=upperband+dist
    lowerband1=lowerband+dist
    lowerband2=lowerband+dist*0.5
    lowerband3=lowerband
    lowerband4=lowerband-dist*0.5
    lowerband5=lowerband-dist
    //---------------------------------------//
    return iline coloured(r,g,b,alpha)style(line,3),upperband1 coloured(r,g,b,alpha*alu*0.2)style(line,1),upperband2
    coloured(r,g,b,alpha*alu*0.4)style(line,1),upperband3 coloured(r,g,b,alpha*alu*0.6)style(line,1),upperband4
    coloured(r,g,b,alpha*alu*0.8)style(line,1),upperband5 coloured(r,g,b,alpha*alu)style(line,1), lowerband1
    coloured(r,g,b,alpha*alw*0.2)style(line,1), lowerband2 coloured(r,g,b,alpha*alw*0.4)style(line,1),lowerband3
    coloured(r,g,b,alpha*alw*0.6)style(line,1),lowerband4 coloured(r,g,b,alpha*alw*0.8)style(line,1),lowerband5
    coloured(r,g,b,alpha*alw)style(line,1)
    npam thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Conversion of Dynamic Flow Ribbons from TradingView


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
npam @npam Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Iván González
6 months, 4 weeks ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 07/09/2025
Status: Active
Attachments: 1 files
Logo Logo
Loading...