Autotrading with Renko Bars

Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #118508 quote
    Majellan
    Participant
    Average

    Hello,

    Is it possible to create an automated trading system using Renko Bars?

    If so, could you tell me how to get started please?

    How do I define a renko bar instead of a normal candle?

    Thank you.

    #118510 quote
    robertogozzi
    Moderator
    Master

    Searching the forum for the word RENKO will return the info you need.

    You can also browse https://www.prorealcode.com/topics-tag/renko/.

    #118513 quote
    Majellan
    Participant
    Average

    Is it possible in PRT to show the result of a backtest on a Renko chart – with the little buy/sell arrows etc. just to see if the Renko code is working as intended

    #118516 quote
    Vonasi
    Moderator
    Master

    Topic moved to ProOrder forum as your questions are strategy related and not indicator related. Please try to post in the most relevant forum for your topic with future questions.

    #118603 quote
    Majellan
    Participant
    Average

    I  cannot find the post in the ProOrder Form. Could you post a link please?

    #118604 quote
    robertogozzi
    Moderator
    Master

    How come you could post here without knowing where this place is?!

    #118605 quote
    Majellan
    Participant
    Average

    Is it possible in PRT to show the result of a backtest on a Renko chart – with the little buy/sell arrows etc. just to see if the Renko code is working as intended

    #118606 quote
    robertogozzi
    Moderator
    Master

    I hope Nicolas or someone else can help you.

    I posted some links and gave you a few hints on how to find info, but I never dealt with Renko bars myself.

    Did you read those posts? I remember having read many times about Renko bars and TS’s.

    I don’t think is possible with v10.3, but v11 should have some support for Renko charts.

    #118626 quote
    Nicolas
    Keymaster
    Master

    It is not possible to run an automated trading strategy on renko chart, however we can simulate that kind of price representation in the code. This simple code is an example on how to achieve the same thing as the renko chart itself.

    Defparam cumulateorders = false
    
    boxSize = 40
    
    once renkoMax = ROUND(close / boxSize) * boxSize
    once renkoMin = renkoMax - boxSize
    
    IF high > renkoMax + boxSize THEN
    WHILE high > renkoMax + boxSize
    renkoMax = renkoMax + boxSize
    renkoMin = renkoMin + boxSize
    WEND
    
    ELSIF low < renkoMin - boxSize THEN
    WHILE low < renkoMin - boxSize
    renkoMax = renkoMax - boxSize
    renkoMin = renkoMin - boxSize
    WEND
    ENDIF
    
    buy at renkoMax + boxSize stop
    sellshort at renkoMin - boxSize stop
    #118680 quote
    Majellan
    Participant
    Average

    Thank you

    #118687 quote
    GraHal
    Participant
    Master

    Nicholas code added as Log 199 here …

    Snippet Link Library

    Léo thanked this post
    #144976 quote
    Léo
    Participant
    Average

    Dear All,

    I tried to add the calulation of the boxsize based on ATR but I must be missing something obvious as no trade is taken in backtest.

    I tried Boxsize = Average[200](averagetruerange[14]); boxsize = averagetruerange[14] and boxsize = averagetruerange[14]*pipsize but nothin works.

    If someone can point my mistake that would be helpful.

    Best regards.

    Alex

    Defparam cumulateorders = false
    
    boxsize = averagetruerange[14]*pipsize
     
    once renkoMax = ROUND(close / boxSize) * boxSize
    once renkoMin = renkoMax - boxSize
     
    IF high > renkoMax + boxSize THEN
    WHILE high > renkoMax + boxSize
    renkoMax = renkoMax + boxSize
    renkoMin = renkoMin + boxSize
    WEND
     
    ELSIF low < renkoMin - boxSize THEN
    WHILE low < renkoMin - boxSize
    renkoMax = renkoMax - boxSize
    renkoMin = renkoMin - boxSize
    WEND
    ENDIF
     
    buy at renkoMax + boxSize stop
    sellshort at renkoMin - boxSize stop
    bertrandpinoy thanked this post
    #144981 quote
    Nicolas
    Keymaster
    Master

    Remove the pipsize multiplier.

    #144983 quote
    Léo
    Participant
    Average

    Hi Nicolas,

    Thanks for your reply.

    I tried also but it does not return any results.

    Alex

    Defparam cumulateorders = false
    
    boxsize = averagetruerange[14]
     
    once renkoMax = ROUND(close / boxSize) * boxSize
    once renkoMin = renkoMax - boxSize
     
    IF high > renkoMax + boxSize THEN
    WHILE high > renkoMax + boxSize
    renkoMax = renkoMax + boxSize
    renkoMin = renkoMin + boxSize
    WEND
     
    ELSIF low < renkoMin - boxSize THEN
    WHILE low < renkoMin - boxSize
    renkoMax = renkoMax - boxSize
    renkoMin = renkoMin - boxSize
    WEND
    ENDIF
     
    buy at renkoMax + boxSize stop
    sellshort at renkoMin - boxSize stop
    #144985 quote
    Nicolas
    Keymaster
    Master

    It makes sense, the renko brick code you use seeks to fix the construction of the bricks to round numbers like the internal indicator of the platform does. Except if the ATR has a value so the rest of the division is not 0, then the code cannot fix the construction of the bricks and nothing happens. To build renko candles with the ATR, I will suggests this code:

    boxsize = AverageTrueRange[14](close)
    
    once topprice = close
    once bottomprice = close - boxsize
    
    if(high > topprice + boxsize*2) THEN
    topprice = close
    bottomprice = topprice - boxsize*2
    ELSIF (low < bottomprice - boxsize*2) THEN
    bottomprice = close
    topprice = bottomprice + boxsize*2
    ELSE
    topprice = topprice
    bottomprice = bottomprice
    ENDIF
    
    
    RETURN topprice as "box top", bottomprice as "bottom box"
Viewing 15 posts - 1 through 15 (of 24 total)
  • You must be logged in to reply to this topic.

Autotrading with Renko Bars


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Majellan @pbateson9 Participant
Summary

This topic contains 23 replies,
has 5 voices, and was last updated by Sterk
3 years, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/03/2020
Status: Active
Attachments: 3 files
Logo Logo
Loading...