Forums › ProRealTime English forum › ProOrder support › Discussion re Pure Renko strategy › Reply To: Discussion re Pure Renko strategy
06/22/2020 at 7:24 PM
#136817
here’s some code for a fast timeframe.
For i.e. 5 seconds tf I use 0.5% stoploss, but prefer a faster exit for a loss. A faster exit results likely in a lower winchance though. But live creates often more max losses then a short backtest.
First code is a familiar one, created 2 variations.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
// support & resistence once supportresistance = 0 // exit [0-1-2] // timeframe(30 seconds) if supportresistance then pivotbar = 20 lookback = 20 barlookback = pivotbar + 1 if low[pivotbar] < lowest[lookback](low)[barlookback] then if low[pivotbar] = lowest[barlookback](low) then supportprice = low[pivotbar] endif endif if high[pivotbar] > highest[lookback](high)[barlookback] then if high[pivotbar] = highest[barlookback](high) then resistanceprice = high[pivotbar] endif endif endif timeframe(default) if supportresistance=1 then if ((longonmarket and shortonmarket[1]) or (longonmarket and not onmarket[1])) then sup=supportprice endif if ((shortonmarket and longonmarket[1]) or (shortonmarket and not onmarket[1])) then res=resistanceprice endif elsif supportresistance=2 then sup=supportprice res=resistanceprice endif if supportresistance=1 or supportresistance=2 then if longonmarket then sell at sup stop endif if shortonmarket then exitshort at res stop endif endif graphonprice sub graphonprice res |
code below is created from scratch. It takes the lowest low before a long entry for xx periods and starts recording new highs. There are 2 ways of exits. If you want a clear break you can set a breakvalue.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
// exitpivot once exitpivot=2 // exit [0-1-2] // if exitpivot=1 or exitpivot=2 then duration=360 // 720 = 1 hour lookback on 5s breakvalue=0 // if not onmarket then prell=0 prehh=0 endif if longonmarket then prehh=highest[max(1,(barindex-tradeindex))](high) endif if ((longonmarket and shortonmarket[1]) or (longonmarket and not onmarket[1])) then prell=lowest[duration](low) endif if shortonmarket then prell=lowest[max(1,(barindex-tradeindex))](low) endif if ((shortonmarket and longonmarket[1]) or (shortonmarket and not onmarket[1])) then prehh=highest[duration](high) endif if onmarket then fibpivot=(prehh-prell)*0.618 else fibpivot=0 endif if exitpivot=1 then if longonmarket then sell at (prehh-fibpivot)-breakvalue stop endif if shortonmarket then exitshort at (prell+fibpivot)+breakvalue stop endif endif if exitpivot=2 then if longonmarket then sell at prell-breakvalue stop endif if shortonmarket then exitshort at prehh+breakvalue stop endif endif endif graphonprice prehh graphonprice prell graphonprice prell+fibpivot coloured(255,0,0,255) as "short exit" graphonprice prehh-fibpivot coloured(0,0,255,255) as "long exit" |