Help porting Donchian Trend Ribbon

Forums ProRealTime English forum ProBuilder support Help porting Donchian Trend Ribbon

Viewing 8 posts - 1 through 8 (of 8 total)
  • #214596

    Hello All,

    I’m interested in Donchian Trend Ribbon available in TradingView https://www.tradingview.com/script/PxLqmP8o-Donchian-Trend-Ribbon/ .

    I started porting it to ProRealTime but I’m struggling. This is my code so far. It could be improved with loops etc. but I wanted to keep it simple until I have something working.

    As I’m not sure it is possible to achieve the same kind in graphical display (with all the plots) I wanted to replace it with a value, i.e. summing the different results.

    Any advice/help would be more than welcomed.
    Thanks.

    This is the TradinvView code

    #214652
    JS

    Hi,

    Perhaps for inspiration…

    1 user thanked author for this post.
    #214861

    JS,

    Thanks a lot for your inspiration which helped a lot.

    I came up with the below code which is almost correct I believe.

    I’m however still very surprised with the differences between PRT and TV.
    See screen capture as an example but I get more or less the same kind of discrepancies with all the instruments.

    Does anybody have an idea what could be the reason?

    Thanks.

    PS: If somebody confirm the code is 100% correct I could publish it to the Library but I don’t want to do it if it contains errors.

    #214935

    I believe I’m almost there with the latest version below but there is still a problem as for the same bar index the colors never change!!!

    Could anybody spot where the problem is? See image for a comparaison between the below code and TV.

    Thanks

    #214941
    JS

    Hi @Lavallette

    In the TV code, each bar is divided into 10 pieces:

    plot( 5, color = dchannelalt(dlen – 0, maintrend), style = plot.style_columns, histbase= 0)

    plot(10, color = dchannelalt(dlen – 1, maintrend), style = plot.style_columns, histbase= 5)

    plot(15, color = dchannelalt(dlen – 2, maintrend), style = plot.style_columns, histbase=10)

    plot(20, color = dchannelalt(dlen – 3, maintrend), style = plot.style_columns, histbase=15)

    plot(25, color = dchannelalt(dlen – 4, maintrend), style = plot.style_columns, histbase=20)

    plot(30, color = dchannelalt(dlen – 5, maintrend), style = plot.style_columns, histbase=25)

    plot(35, color = dchannelalt(dlen – 6, maintrend), style = plot.style_columns, histbase=30)

    plot(40, color = dchannelalt(dlen – 7, maintrend), style = plot.style_columns, histbase=35)

    plot(45, color = dchannelalt(dlen – 8, maintrend), style = plot.style_columns, histbase=40)

    plot(50, color = dchannelalt(dlen – 9, maintrend), style = plot.style_columns, histbase=45)

    Thus, each column (Bar) in the indicator consists of 10 pieces of 5 high (total 50 high). These pieces also have a different color so that you can see a difference per column (Bar)…

    In the PRT code, 1 rectangle is drawn per bar with 1 color and therefore you see no difference in color in the same bar index…

    What you can do is also make a subdivision (10 pieces) and draw a rectangle with a certain color ten times per bar…

    (Total height column is 50 divided into 10 pieces of 5)

    1 user thanked author for this post.
    #214947

    Thanks.

    Is this not what my code does?

    10 rectangles are drawn per bar of size 1 by 1. Vertical y-axis goes from 0 to 10.
    4 Colors are possible, Green , DarkGreen, Red or DarkRed.

    This is visible on the capture below.

    But why are some rectangles on the same x-axis not of 2 different colours?!?!

    Something is obviously wrong but I cannot find what!

    Still scratching my head.

    #214950
    JS

    Hi @Lavallette

    It’s starting to look more and more like it… 😉

    #214972

    @SJ Thanks again for your time.

    I don’t understand why

    is different from

    and then referencing it with

    I would have thought it would be the same. Could this be a bug?

    Your latest version gives better result but still as you can see not completely correct.https://www.tradingview.com/script/PxLqmP8o-Donchian-Trend-Ribbon/

    Could it be that way the “for loop” manages the hhh and lll series?

    In case you still want to spend some time on this thread you can test it as well from https://www.tradingview.com/script/PxLqmP8o-Donchian-Trend-Ribbon/ .

     

    Anyway thanks a lot.

Viewing 8 posts - 1 through 8 (of 8 total)

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