ReNKoLiNe - A line on chart mimicking RENKO bricks
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © KristianStefanov
//@version=4

// DESCRIPTION
// RENKOLINE Idicator - mimics RENKO charts on ANY timeframe. It is not absolutely fixed, which is actually advantage, 
//because it does not close bricks before the actual close of a candle.
// An advantage, if one knows how to play with the "bricksize"
//Of course it has a short side of delaying entry in case the direction momentum continiues.

//CDL is difference between current close and the RenkoLine Candle(close) to Line(renko). This could provide idea for the deviation between candle close and line value.
//It is only a value. I did not find a way to draw it properly. Someone more experienced could help :) 

//DEFINITIONS AND EXPRESSIONS - INPUTs
study("ReNKoLiNe", shorttitle="RNL", overlay=true)
max_bar_back = 72000
PIPu=input(title="PIPs+", type=input.float, defval=0.0010)
PIPd=input(title="PIPs-", type=input.float, defval=-0.0010)

var RNL = close
CDL_CloseToRenkoLine = (close - RNL)
//CALCULAIONS & RULES
if(close[0]-RNL[1]<= PIPd)
    RNL := close[0]
if(close[0]-RNL[1]>= PIPu)
    RNL := close[0]
else 
    RNL[1]

//DRAW ON CHART  
plot(RNL, linewidth=2,title="RNL", color=color.rgb(177,165,79))
plot(CDL_CloseToRenkoLine,title="CDL", linewidth=2,style=plot.style_histogram, color=color.rgb(7,165,150))

