Renko trading system (very general, applicable e.g. for DAX 15 min chart) goes long when at least 2 upbricks appear after a downtrend of 2 bricks or more goes short when 2 downbricks appear after an uptrend of 2 bricks or more.
“bricksize” is the length of a Renko brick in points and be modified (line 3).
“BIfirst” is the first bar in the chart that defines the position of all other Renko bricks. Can be left out, but can makes a big difference.
defparam cumulateorders = false
bricksize = 22
BIfirst = 1
n = 1
If barindex >= BIfirst then
ONCE upbrick = close
ONCE downbrick = close - bricksize
buysignal = 0
shortsignal = 0
IF close >= upbrick + bricksize THEN
newbricksup = (round(((close - upbrick) / bricksize) - 0.5))
diffup = newbricksup * bricksize
downbrick = downbrick + diffup
upbrick = upbrick + diffup
totalbricksup = totalbricksup + newbricksup
totalbricksdown = 0
If (totalbricksup[1] = 0 OR totalbricksup[1] = 1) AND totalbricksup >= 2 then
buysignal = 1
endif
ELSIF close <= downbrick - bricksize THEN
newbricksdown = (round(((downbrick - close) / bricksize) - 0.5))
diffdown = newbricksdown * bricksize
upbrick = upbrick - diffdown
downbrick = downbrick - diffdown
totalbricksdown = totalbricksdown + newbricksdown
totalbricksup = 0
If (totalbricksdown[1] = 0 OR totalbricksdown[1] = 1) AND totalbricksdown >= 2 then
shortsignal = 1
endif
ENDIF
endif
If buysignal = 1 then
buy n contracts at market
endif
If shortsignal = 1 then
sellshort n contracts at market
endif
set stop ploss 120