Nicolas Renko System

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18290 quote
    Mark
    Participant
    Senior

    Hi,

    I have been studying the concept of the Renko system,

    I am interested in adopting this system but with money management/position sizing incorporated into it. Is this something that can be achievable with this type of system? I am trying to add it but struggling to code the position sizing.

     

    Mark

    #18554 quote
    Nicolas
    Keymaster
    Master

    Position sizing/money management can be incorporated into any automated trading strategies you’ll find into the Library. The lot sizing is only a variable that adjust dynamically to your profit and loss with its own calculation.

    I believe you are talking about this renko trading strategy: http://www.prorealcode.com/prorealtime-trading-strategies/renko-automated-trading-with-moving-average-on-candlesticks-chart/

    So please find below the modified code with the money management position sizing:

    defparam cumulateorders = false
    
    REM Money Management
    Capital = 10000
    Risk = 0.01
    StopLoss = 10 // Could be our variable X
    
    REM Calculate contracts
    equity = Capital + StrategyProfit
    maxrisk = round(equity*Risk)
    PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)
    
    bsize = 20 //renko size in points
    mmperiod = 20 //moving average period
    orderstime = 300 //minimum seconds between 2 orders
    
    boxsize = bsize*pipsize
    
    once topprice = close
    once bottomprice = close - boxsize*pipsize*2
    
    if(close > topprice + boxsize*2) THEN
     topprice = close
     bottomprice = topprice - boxsize*2
     barclose=topprice
    ELSIF (close < bottomprice - boxsize*2) THEN
     bottomprice = close
     topprice = bottomprice + boxsize*2
     barclose = bottomprice
    ELSE
     topprice = topprice
     bottomprice = bottomprice
    ENDIF
    
    mm = average[mmperiod](barclose)
    
    if barclose=barclose[1] then
     mmRENKO = mmRENKO[1]
    else
     mmRENKO = mm
    endif
    
    if barclose crosses over mmRENKO AND ABS(time-lasttime)>orderstime then
     BUY PositionSize SHARES AT MARKET
     EXITSHORT AT MARKET
     lasttime=time
    endif
    
    if barclose crosses under mmRENKO AND ABS(time-lasttime)>orderstime then
     SELLSHORT PositionSize SHARES AT MARKET
     SELL AT MARKET
     lasttime=time
    endif

    Not tested, but should work as intend. Please give feedback.

    #19845 quote
    Mark
    Participant
    Senior

    Hi Nicolas,

    This works for me, thank you

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Nicolas Renko System


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Mark @mbaker15 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Mark
9 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/12/2016
Status: Active
Attachments: No files
Logo Logo
Loading...