Discussion re Pure Renko strategy

Viewing 15 posts - 1 through 15 (of 346 total)
  • Author
    Posts
  • #120404 quote
    GraHal
    Participant
    Master

    edit : new topic from https://www.prorealcode.com/topic/why-is-backtesting-so-unreliable/

    According to IG Status Page … all trading platforms are now sorted!! See attached.

    This Renko code is the only code I am still getting Rejects / Stoppages on (up to now anyway!?).

    Only major difference I can see between this System and my others is the use of While, Wend? Maybe While. Wend has recently become a non-approved term anymore??


    @Nonetheless
    would it be easy for you to re-code without While, Wend?  I know the code is a DocTrading code so maybe it not easy for you either?

    If one of our coding wizards might be able to help it would be much appreciated?

    Below is the code of the System that is showing +£1.8K profit since October (see attached).

    //-------------------------------------------------------------------------
    // Main code : Nneless Renko DJI 1M v1
    //-------------------------------------------------------------------------
    //https://www.prorealcode.com/topic/why-is-backtesting-so-unreliable/#post-110889
    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    // The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the "FLATBEFORE" time.
    //DEFPARAM FLATBEFORE = 143000
    // Cancel all pending orders and close all positions at the "FLATAFTER" time
    //DEFPARAM FLATAFTER = 210000
    boxSize = 110 //50
    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 1 CONTRACT at renkoMax + boxSize stop
    sellshort 1 CONTRACT at renkoMin - boxSize stop
    // Stops and targets
    SET STOP PLOSS 75
    SET TARGET PPROFIT 150
    
    Paul, nepu77 and Bard thanked this post
    GH-7.jpg GH-7.jpg GH-8.jpg GH-8.jpg
    #120416 quote
    Paul
    Participant
    Master

    maybe this?

    IF high > renkoMax + boxSize THEN
    renkoMax = renkoMax + boxSize
    renkoMin = renkoMin + boxSize
    ELSIF low < renkoMin - boxSize THEN
    renkoMax = renkoMax - boxSize
    renkoMin = renkoMin - boxSize
    ENDIF
    GraHal, nonetheless and Bard thanked this post
    #120422 quote
    GraHal
    Participant
    Master

    Hahaha … nice one Paul!

    Your change works (same profits etc) and System has NOT been rejected!

    Feeling guilty now that I didn’t persevere with the code.

    I had heard others on here mention While, Wend and the terms are on here under approved probuilder language documentation and so I doubted this would be the Issue, but seems it is!

    Now I can try my other forks piling up ready to be Forward Tested!

    Onward and Upward!

    Thank You
    Grahal

    Paul thanked this post
    #120423 quote
    nonetheless
    Participant
    Master

    showing +£1.8K profit since October

    That is not too shabby at all, thanks to DocTrading (and also to Paul!) who did the heavy lifting…

    Paul, GraHal and Bard thanked this post
    #120437 quote
    GraHal
    Participant
    Master
    @nonetheless it would make sense / logical to ask the Mods to change the name of this Topic to …

    Discussion re Pure Renko strategy

    https://www.prorealcode.com/prorealtime-trading-strategies/pure-renko-strategy/ Also there may be ‘some mileage‘ in checking out the other two Renko Systems in the Library? I keep meaning to, but my self-build is limiting my time for a while, sorry. https://www.prorealcode.com/prorealtime-trading-strategies/renko-automated-trading-system/ https://www.prorealcode.com/prorealtime-trading-strategies/renko-automated-trading-with-moving-average-on-candlesticks-chart/
    #120440 quote
    Paul
    Participant
    Master
    now wondering if it could be used on a higher timeframe. Couldn’t resist!  100k tested so far on 15 min dow, spread 3.1
    //-------------------------------------------------------------------------
    // main code : nneless renko dji 1m v1
    //-------------------------------------------------------------------------
    //https://www.prorealcode.com/topic/why-is-backtesting-so-unreliable/#post-110889
    defparam cumulateorders = false
    defparam preloadbars    = 1000
    
    timeframe (default)
    
    boxsize = 100
    
    once renkomax = round(close / boxsize) * boxsize
    once renkomin = renkomax - boxsize
    
    if high > renkomax + boxsize then
    renkomax = renkomax + boxsize
    renkomin = renkomin + boxsize
    elsif low < renkomin - boxsize then
    renkomax = renkomax - boxsize
    renkomin = renkomin - boxsize
    endif
    
    ctime=hour>=4
    
    if ctime then
    buy 1 contract at renkomax + boxsize stop
    sellshort 1 contract at renkomin - boxsize stop
    else
    exitshort 1 contract at renkomax + boxsize stop
    sell 1 contract at renkomin - boxsize stop
    endif
    
    // trailingstop splitsed so it can run on higher timeframe
    timeframe (15 minutes,updateonclose)
    
    // trailing atr stop
    once trailingstoptype     = 1    // trailing stop - 0 off, 1 on
    once trailingstoplong     = 7    // trailing stop atr relative distance
    once trailingstopshort    = 4    // trailing stop atr relative distance
    
    once atrtrailingperiod    = 14  // atr parameter value
    once minstop              = 10    // minimum trailing stop distance
    
    // trailingstop
    //----------------------------------------------
    atrtrail = averagetruerange[atrtrailingperiod]((close/10)*pipsize)/1000
    trailingstartl = round(atrtrail*trailingstoplong)
    trailingstarts = round(atrtrail*trailingstopshort)
    //
    if trailingstoptype then
    tgl =trailingstartl
    tgs=trailingstarts
    if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then
    maxprice = 0
    minprice = close
    newsl = 0
    endif
    if longonmarket then
    maxprice = max(maxprice,close)
    if maxprice-tradeprice(1)>=tgl*pointsize then
    if maxprice-tradeprice(1)>=minstop then
    newsl = maxprice-tgl*pointsize
    else
    newsl = maxprice - minstop*pointsize
    endif
    endif
    endif
    if shortonmarket then
    minprice = min(minprice,close)
    if tradeprice(1)-minprice>=tgs*pointsize then
    if tradeprice(1)-minprice>=minstop then
    newsl = minprice+tgs*pointsize
    else
    newsl = minprice + minstop*pointsize
    endif
    endif
    endif
    endif
    
    timeframe (default)
    
    if trailingstoptype then
    if longonmarket then
    if newsl>0 then
    sell at newsl stop
    endif
    endif
    if shortonmarket then
    if newsl>0 then
    exitshort at newsl stop
    endif
    endif
    endif
    
    // stops and targets
    set stop %loss 2
    set target %profit 2
    
    graphonprice renkomax + boxsize
    graphonprice renkomin - boxsize
    
    nonetheless and Francesco thanked this post
    Screenshot-2020-02-25-at-13.47.46.jpg Screenshot-2020-02-25-at-13.47.46.jpg
    #120447 quote
    nonetheless
    Participant
    Master
    it would make sense / logical to ask the Mods to change the name of this Topic to … Discussion re Pure Renko strategy
    Yes, absolutely … how do I go about that? I’m waving my arms but guess they can’t see me.
    #120448 quote
    nonetheless
    Participant
    Master
    wondering if it could be used on a higher timeframe
    Hey, my thoughts exactly! The 1m TF always seemed wrong. Now it’s really starting to look interesting…
    #120450 quote
    Francesco
    Participant
    Veteran
    Make a statue to Paul thanks
    Paul thanked this post
    #120451 quote
    GraHal
    Participant
    Master
    how do I go about that?
    @Vonasi or @RobertoGozzi might check out all the action on this Topic  and now – as OP – you are asking for the title to be changed, they may sort it for us? Now Paul is onboard I can see us having all sorts Renko versions in this Topic so Mods please … New Topic Required …

    Renko Systems

    #120503 quote
    Paul
    Participant
    Master
    there’s a bug at monday 00.00.00 where there shouldn’t be an entry. With the bug the results are better though. pics are with spread 100k & 200k
    //-------------------------------------------------------------------------
    // main code : nneless renko dji 15min v1
    //-------------------------------------------------------------------------
    //https://www.prorealcode.com/topic/why-is-backtesting-so-unreliable/#post-110889
    defparam cumulateorders = false
    defparam preloadbars    = 1000
    
    timeframe (default)
    
    once bugfix=0 // [1] activate bugfix monday time 00.00.00
    
    once boxsize = 100
    
    once renkomax = round(close / boxsize) * boxsize
    once renkomin = renkomax - boxsize
    
    if high > renkomax + boxsize then
    renkomax = renkomax + boxsize
    renkomin = renkomin + boxsize
    elsif low < renkomin - boxsize then
    renkomax = renkomax - boxsize
    renkomin = renkomin - boxsize
    endif
    
    condbuy=1
    condsell=1
    
    ctime=hour>=3
    
    if bugfix then
    if dayofweek=5[1] and (hour[1]=22 or hour[1]=21) then
    skipmondayfirsthour=0
    else
    skipmondayfirsthour=1
    endif
    else
    skipmondayfirsthour=1
    endif
    
    if ctime  then
    if skipmondayfirsthour then
    if condbuy then
    buy 1 contract at renkomax + boxsize stop
    endif
    if condsell then
    sellshort 1 contract at renkomin - boxsize stop
    endif
    endif
    endif
    
    // trailingstop splitsed so it can run on higher timeframe
    timeframe (15 minutes,updateonclose)
    
    // trailing atr stop
    once trailingstoptype     = 1    // trailing stop - 0 off, 1 on
    once trailingstoplong     = 7    // trailing stop atr relative distance
    once trailingstopshort    = 4    // trailing stop atr relative distance
    
    once atrtrailingperiod    = 14  // atr parameter value
    once minstop              = 10    // minimum trailing stop distance
    
    // trailingstop
    //----------------------------------------------
    atrtrail = averagetruerange[atrtrailingperiod]((close/10)*pipsize)/1000
    trailingstartl = round(atrtrail*trailingstoplong)
    trailingstarts = round(atrtrail*trailingstopshort)
    //
    if trailingstoptype then
    tgl =trailingstartl
    tgs=trailingstarts
    if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then
    maxprice = 0
    minprice = close
    newsl = 0
    endif
    if longonmarket then
    maxprice = max(maxprice,close)
    if maxprice-tradeprice(1)>=tgl*pointsize then
    if maxprice-tradeprice(1)>=minstop then
    newsl = maxprice-tgl*pointsize
    else
    newsl = maxprice - minstop*pointsize
    endif
    endif
    endif
    if shortonmarket then
    minprice = min(minprice,close)
    if tradeprice(1)-minprice>=tgs*pointsize then
    if tradeprice(1)-minprice>=minstop then
    newsl = minprice+tgs*pointsize
    else
    newsl = minprice + minstop*pointsize
    endif
    endif
    endif
    endif
    
    timeframe (default)
    
    if trailingstoptype then
    if longonmarket then
    if newsl>0 then
    sell at newsl stop
    endif
    endif
    if shortonmarket then
    if newsl>0 then
    exitshort at newsl stop
    endif
    endif
    endif
    
    // stops and targets
    set stop %loss 2
    set target %profit 2
    
    graphonprice renkomax + boxsize
    graphonprice renkomin - boxsize
    
    GraHal, nonetheless and Francesco thanked this post
    Screenshot-2020-02-25-at-21.13.18.jpg Screenshot-2020-02-25-at-21.13.18.jpg Screenshot-2020-02-25-at-21.13.46.jpg Screenshot-2020-02-25-at-21.13.46.jpg
    #120545 quote
    nonetheless
    Participant
    Master
    Sadly the robustness test is a bust for this one. Odd because I had thought that Renko bars were time independent and that it might perform better than most. 🤔
    DJI-15m-Renko-vrt.jpg DJI-15m-Renko-vrt.jpg
    #120551 quote
    GraHal
    Participant
    Master
    Would be worth putting a link to your post above on Vonasi Robustness Tester Topic … he might have some useful observation re Renko and Robustness tests?
    #120552 quote
    nonetheless
    Participant
    Master
    Here’s an interesting development. Starting with the 1m version that @Grahal was running I added a trailing stop, tweaked the boxsize, stop and TP — ran it on daily TF for a 20 year back test. Very low % win but the stop loss is just .1% so it works even with lots of small losses. WF is as good as it gets, robustness checks out…
    Paul thanked this post
    DOW-Daily-Renko-20y-WF.jpg DOW-Daily-Renko-20y-WF.jpg DOW-Daily-Renko-vrt.jpg DOW-Daily-Renko-vrt.jpg DOW-Daily-Renko.itf
    #120555 quote
    Francesco
    Participant
    Veteran
    Can you also do the 21 5 and the 20 5 in order to look at the total average?
Viewing 15 posts - 1 through 15 (of 346 total)
  • You must be logged in to reply to this topic.

Discussion re Pure Renko strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 345 replies,
has 24 voices, and was last updated by bertrandpinoy
5 years, 7 months ago.

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