Renko PRT Renko PRC

Forums ProRealTime English forum ProBuilder support Renko PRT Renko PRC

Tagged: 

Viewing 10 posts - 1 through 10 (of 10 total)
  • #186812

    Hello everyone,

    I’m trying to replicate the same Renko as PRT. I chose Boxsize 100 on Dow H1 and used the code provided by Nicolas   here https://www.prorealcode.com/prorealtime-indicators/renko-boxes-on-price-chart/

    However, the values are sometimes identical and sometimes different. I’d like to have the exact same values than PRT. Can someone please help?

    Thanks

    #186824

    I think your problem come that the price can “jump” 2 or more renko bars size during 1 code read, and you can only paint 1 bar on a single period. That’s tricky to code, I know this product from the marketplace replicate the same exact values with quantity of boxes, on a classic chart: https://market.prorealcode.com/product/prt-renko/

    1 user thanked author for this post.
    #186839

    After searching a bit, I found this free code on TradingView (Pine). It’s way beyond my conversion skills. If someone is interested to convert it.

    //@version=4
    study(“Renko”, max_bars_back = 5000)
    get_renko(box_size) =>
    var float base_price = input(title=”Base price”, type=input.source, defval=close)
    var float r_open = base_price – box_size
    var float r_close = close
    var int up_list = 0
    var int down_list = 0
    var int up_move = 0
    var int down_move = 0
    var int built_bricks_up = 0
    var int built_bricks_down = 0
    var int counter_up_series = 0
    var int counter_down_series = 0
    var int required_series_up = 0
    var int required_series_down = 0
    var int required_bricks_up = 0
    var int required_bricks_down = 0
    var bool b_up_list = false
    var bool b_down_list = false
    var bool b_up_move = false
    var bool b_down_move = false
    var bool in_the_range_up = false
    var bool in_the_range_down = false
    var int up_stop_index = 0
    var int down_stop_index = 0
    var int up_temporary_index = 0
    var int down_temporary_index = 0
    // creating lists
    if bar_index > 0
    if close > open
    down_move := 0
    if b_up_list
    up_move := int((close – base_price) / box_size)
    if up_move > up_list
    up_list := up_move
    down_list := na
    else if b_down_list
    up_move := int((close – (base_price – down_list * box_size)) / box_size)
    else
    down_list := na
    up_list := na
    else if close < open
    up_move := 0
    if b_down_list
    down_move := int((base_price – close) / box_size)
    if down_move > down_list
    down_list := down_move
    up_list := na
    else if b_up_list
    down_move := int(((base_price + up_list * box_size) – close) / box_size)
    else
    down_list := na
    up_list := na
    if b_up_list and down_move >= 2
    base_price := base_price + (up_list – 1) * box_size
    b_up_list := false
    up_list := na
    b_down_list := true
    down_list := down_move – 1

    else if b_down_list and up_move >= 2
    base_price := base_price – (down_list – 1) * box_size
    b_down_list := false
    down_list := na
    b_up_list := true
    up_list := up_move – 1

    if not b_up_list and not b_down_list
    up_move := int((close – base_price) / box_size)
    down_move := int((base_price – close) / box_size)
    if up_move > 0
    down_move := 0
    b_up_list := true
    b_up_move := true
    up_list := up_move
    down_list := na
    else if down_move > 0
    up_move := 0
    b_down_list := true
    b_down_move := true
    down_list := down_move
    up_list := na
    else
    up_list := na
    down_list := na
    r_close := na
    // creating open and close series
    if b_up_move
    for i = 0 to bar_index – up_stop_index – 1
    if not na(up_list[i]) and na(up_list[i+1])
    counter_up_series := counter_up_series + 1
    required_bricks_up := up_list[i]
    if i == bar_index – up_stop_index – 1
    for j = i to 0
    up_temporary_index := bar_index[j]
    required_bricks_up := up_list[j]
    if j == 0
    break
    if not na(up_list[j]) and na(up_list[j-1])
    up_temporary_index := bar_index[j-1]
    break
    break
    if counter_up_series == 1 and not na(up_list[0])
    in_the_range_up := true
    counter_up_series := 0
    if built_bricks_up < required_bricks_up
    r_open := r_open + box_size
    r_close := r_open + box_size
    built_bricks_up := built_bricks_up + 1

    else if in_the_range_up and built_bricks_up == required_bricks_up
    r_close := na
    else
    up_stop_index := up_temporary_index
    built_bricks_up := 0
    built_bricks_down := 1
    b_up_move := false
    b_down_move := true
    r_close := r_open – box_size

    in_the_range_up := false
    else if b_down_move
    for i = 0 to bar_index – down_stop_index – 1
    if not na(down_list[i]) and na(down_list[i+1])
    counter_down_series := counter_down_series + 1
    required_bricks_down := down_list[i]
    if i == bar_index – down_stop_index – 1
    for j = i to 0
    down_temporary_index := bar_index[j]
    required_bricks_down := down_list[j]
    if j == 0
    break
    if not na(down_list[j]) and na(down_list[j-1])
    down_temporary_index := bar_index[j-1]
    break
    break
    if counter_down_series == 1 and not na(down_list[0])
    in_the_range_down := true
    counter_down_series := 0
    if built_bricks_down < required_bricks_down
    if up_stop_index == 0 and down_stop_index == 0 and built_bricks_down == 0
    r_open := r_open + box_size
    r_close := r_open – box_size
    built_bricks_down := built_bricks_down + 1
    else
    r_open := r_open – box_size
    r_close := r_open – box_size
    built_bricks_down := built_bricks_down + 1
    else if in_the_range_down and built_bricks_down == required_bricks_down
    r_close := na
    else
    down_stop_index := down_temporary_index
    built_bricks_down := 0
    built_bricks_up := 1
    b_down_move := false
    b_up_move := true
    r_close := r_open + box_size
    in_the_range_down := false
    else
    r_close := na
    [r_open, r_open > r_close ? r_open : r_close, r_open < r_close ? r_open : r_close, r_close]
    [r_open, r_high, r_low, r_close] = get_renko(input(defval = 200.0, title = “Box size”, type = input.float, minval = 0.00000001))
    plotcandle(r_open, r_high, r_low, r_close, color = r_close > r_open ? color.green : color.red)

     

    #186865

    @Nicolas

    I tried my best to convert the above code. I’m stuck in the loops where I think I didn’t place the “endif” in the appropriate location.

    I need a bit of help PLEEEEEEEAAAASE!

    Thanks a million!

     

    #186870

    The best I could with my limited coding skills. Except a few exceptions, all the open and close match the PRT Renko. Can you please Nicolas have a look if it’s correct and why I have gaps between certain Renko candles?

     

    #186877

    Sorry if I’m posting too much. I hope you can review this very last version, which seems to replicate exactly the PRT Renko, with no gaps between boxes.

    the graph in blue is the version with %, changing boxsize from 50pts to “close*.1/100”

    #187322

    @Nicolas Good morning, may I please take a little bit of your time to review the latest Renko code posted above? Many Thanks!

    #187324

    If you apply your indicator on a renko chart, it will obviously create renko bars. Did you try on classic chart? I thought it was the purpose of  your query in the first place?

    #187327

    Indeed. Just wanted to use this code in a strategy as Exit when the Renko changes color. As you know the PRT native Renko cannot be added in ProOrder. So, if you can please check if this code is consistent with PRT native Renko. Many Thanks

    #187338

    Sorry I don’t get it 🙂 You just have to put your code on a 1 minute chart for instance and compare side by side with a renko chart of the same brick size, so i’m wondering why you are asking me? 🙂

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

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