//PRC_Renko Bricks with Wicks | indicator
//22.05.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//---settings
//boxsize=20 //renko bricks size in points/pips
//transparency=50 //brick colours alpha
//wicksize=1 //width of wicks
//---end of settings
size=boxsize*pointsize
once upbox = close
once downbox = close - size
once lowwick = close*100
IF close > upbox + size THEN
upbox = upbox + size
downbox = downbox + size
r=0
g=200
begin=barindex
highwick=close
wickbar=barindex-round((barindex-begin[1])/2)
ELSIF close < downbox - size THEN
upbox = upbox - size
downbox = downbox - size
r=200
g=0
begin=barindex
wickbar=barindex-round((barindex-begin[1])/2)
ENDIF
//saving current high/low
highwick=max(high,highwick)
lowwick=min(low,lowwick)
//compute wicks at each new contrarian brick
if r>0 and r[1]=0 then
//new red brick
drawrectangle(wickbar,highwick,wickbar+wicksize,upbox[1]) coloured(r[1],g[1],0)
lowwick=low*100
highwick=0
endif
if r=0 and r[1]>0 then
//new green brick
drawrectangle(wickbar,lowwick,wickbar+wicksize,downbox[1]) coloured(r[1],g[1],0)
lowwick=low*100
highwick=0
endif
//compute wicks at each new same brick
if r>0 and r[1]>0 and lastdrawn<>wickbar then
//new red brick
if highwick>upbox[1] then
drawrectangle(wickbar,highwick,wickbar+wicksize,upbox[1]) coloured(r[1],g[1],0)
endif
lastdrawn=wickbar
lowwick=low*100
highwick=0
endif
if r=0 and r[1]=0 and lastdrawn<>wickbar then
//new green brick
if lowwick<downbox[1] then
drawrectangle(wickbar,lowwick,wickbar+wicksize,downbox[1]) coloured(r[1],g[1],0)
endif
lastdrawn=wickbar
lowwick=low*100
highwick=0
endif
//draw renko candlesticks
drawcandle(upbox,upbox,downbox,downbox)coloured(r,g,0,min(transparency,255))
RETURN