How do I apply ATR to smooth out RENKO BOXs?

ATR_Set_RENKOBoxSize

This is a long and short oscillating strategy with RENKO bars and a Ichimoku cloud overlay. If Green RENKO bar and Chiku Span is above the Cloud then Buy. If there is a Red RENKO bar or Chiku Span Closes in the Cloud then Sell. Rules are reversed for shorting. I'm applying the previous trading days average ATR to smooth out the RENKO bars.
The problem is the ATR is producing a number that populates improper RENKO box sizes. If you manually set the RENKO box size to 0.04 then that would be the desired range; However, the ATR is producing 3.14 thus producing an undesired RENKO box size.
Can you convert the ATR into a percentage then adjust the RENKO boxes off that? OR change the parameters around the RENKO box-sizing

Also, I do understand the pic that I have posted shows a 1min chart when it should be in Tick's.

If anyone can lend a helping hand I would be greatly appreciative! (LINE: 35 to 42 ATR Location),

_O = _H = _L = _C = 0;
OrderID = 0;

_atr = Null;
Brick = 0;
toggleBrick = False;
toggleTradeTime = False;

toggleTradeTime = ParamToggle("Trade Time", "9to4|All Day");

/////////////////////////////////////////////

function FillRun(dir, num, changedir) {
	global i, j, modified, dt, RKC, RKO, RKD, RKH, RKL;
	for (x = 1; x <= num AND j < BarCount - 1; x++) {
		j++;
		extra = (changedir AND x == 1) * dir;
		RKC[j] = RKC[j - 1] + dir + extra;
		RKO[j] = RKC[j - 1] + IIf(modified, 0, extra);
		RKD[j] = dt[i];
		RKH[j] = _H[i - 1];
		RKL[j] = _L[i - 1];
	}
}

function checkTradeTime() {
	tmp = 0;
	if(toggleTradeTime) { tmp = True; }
	else { tmp = (TimeNum() > 90000) AND (TimeNum() < 160000); }
	return tmp;
}

SetBarsRequired(sbrAll, sbrAll); 
//////////////////////////////
toggleBrick = ParamToggle("Use ATR", "OFF|ON");
if(toggleBrick) {
	toggleATR = ParamToggle("ATR", "Today's|Yesterday's");
	TimeFrameSet(inDaily);
	if(toggleATR) { _atr = LastValue(Ref(ATR(14), -1)); }
	else { _atr = LastValue(ATR(14)); }
	TimeFrameRestore();
	Brick = _atr;
}
else {
	Brick = Param("Brick Size", 0.1, 0.0001, 5.00, 0.001);
}

//printf("%g", Brick);
//////////////////////////////
_Reverse = 2;
intra = 0;
modified = 0;

CF = ceil(C / Brick);
CR = floor(C / Brick);

j = 0;
RKC[j] = CF[0];
RKO[j] = CF[0] + 1;
RKD = 0;
RKH = 0;
RKL = 0;
dt = IIf(intra, floor(TimeNum() / 100), DateNum());

dir = -1; // 1 is up, -1 is down

for(i = 1; i < BarCount - 1; i++) { 
	if(j >= BarCount) break;
	if(CF[i] <= RKC[j] - 1 AND dir < 0) {
		num = RKC[j] - CF[i];
		FillRun( dir, num, False ); 
	}
	else if(CR[i] >= RKC[j] + _Reverse AND dir < 0){
		num = CR[i] - RKC[j];
		dir = 1;
		FillRun(dir, num, True);
	}
	else if(CR[i] >= RKC[j] + 1 AND dir > 0) {
		num = CR[i] - RKC[j];
		FillRun(dir, num, False);
	}
	else if(CF[i] <= RKC[j] - _Reverse AND dir > 0) {
		num = RKC[j] - CF[i];
		dir = -1;
		FillRun(dir, num, True);
	}
}

delta =  BarCount - 1 - j;

RKC = Ref(RKC, -delta);
RKO = Ref(RKO, -delta);
RKD = Ref(RKD, -delta);
RKH = Ref(RKH, -delta);
RKL = Ref(RKL, -delta);

_C = RKC * Brick;
_O = RKO * Brick;
_H = IIf(modified, RKH, Max(_C, _O));
_L = IIf(modified, RKL, Min(_C, _O));

//Plot(_C, "", IIf(_C > _O, colorGreen, colorRed), styleCandle); 

xnum = floor(RKD / 100);
XChange = IIf(xnum != Ref( xnum, -1 ), 1, Null);

TenkanSen = 0; //Conversion Line
KijunSen = 0; //Base Line
SenkouSpanA = 0; //Leading Span A
SenkouSpanB = 0; //Leading Span B
ChikouSpan = 0; //Lagging Span

TenkanSen = Param("TenkanSen Period", 9, 5);
KijunSen = Param("KijunSen Period", 26, 5);
SenkouSpanB = Param("SenkouSpanB Period", 52, 5);

TenkanSen = (HHV(_H, TenkanSen) + LLV(_L, TenkanSen))/2; //Conversion Line
KijunSen = (HHV(_H, KijunSen) + LLV(_L, KijunSen))/2; //Base Line
SenkouSpanA = (TenkanSen + KijunSen)/2; //Leading Span A
SenkouSpanB = (HHV(_H, SenkouSpanB) + LLV(_L, SenkouSpanB))/2; //Leading Span B
ChikouSpan = _C; //Lagging Span

/////////////////////////////////
_SenkouSpanA = Ref(SenkouSpanA, -26); //Leading Span A
_SenkouSpanB = Ref(SenkouSpanB, -26); //Leading Span B
_ChikouSpan = Ref(ChikouSpan, 26); //Lagging Span
/////////////////////////////////

Buy = (
		(_C > IIf((_SenkouSpanA > _SenkouSpanB), _SenkouSpanA, _SenkouSpanB)) AND
		(_C > IIf((Ref(_SenkouSpanA, -26) > Ref(_SenkouSpanB, -26)), Ref(_SenkouSpanA, -26), Ref(_SenkouSpanB, -26))) AND
		(_C > _O) AND (Ref(_C, -1) > Ref(_O, -1)) AND checkTradeTime()
	);
Short = (
		(_C < IIf((_SenkouSpanA > _SenkouSpanB), _SenkouSpanB, _SenkouSpanA)) AND
		(_C < IIf((Ref(_SenkouSpanA, -26) > Ref(_SenkouSpanB, -26)), Ref(_SenkouSpanB, -26), Ref(_SenkouSpanA, -26))) AND
		(_C < _O) AND (Ref(_C, -1) < Ref(_O, -1)) AND checkTradeTime()
	);

Sell = (
		(_C < IIf((_SenkouSpanA > _SenkouSpanB), _SenkouSpanA, _SenkouSpanB)) OR
		(_C < IIf((Ref(_SenkouSpanA, -26) > Ref(_SenkouSpanB, -26)), Ref(_SenkouSpanA, -26), Ref(_SenkouSpanB, -26))) OR
		IIf(!toggleTradeTime, (TimeNum() > 160000), False)
	);
Cover = (
		(_C > IIf((_SenkouSpanA > _SenkouSpanB), _SenkouSpanB, _SenkouSpanA)) OR
		(_C > IIf((Ref(_SenkouSpanA, -26) > Ref(_SenkouSpanB, -26)), Ref(_SenkouSpanB, -26), Ref(_SenkouSpanA, -26))) OR
		IIf(!toggleTradeTime, (TimeNum() > 160000), False)
	);

Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
Short = ExRem(Short, Cover);
Cover = ExRem(Cover, Short);

/////////
_SECTION_BEGIN("IB Controller");
	qty = Param("Quantity", 100, 1, 1000);
_SECTION_END();
if(LastValue(Buy) OR LastValue(Cover)) {
	ibc = GetTradingInterface("IB");
	if(ibc.IsConnected()) {
		if(ibc.GetPositionSize(Name()) == 0) {
			OrderID = StaticVarGetText("OrderID"+Name());
			OrderID = ibc.PlaceOrder(Name(), "BUY", qty, "MKT", 0, 0, "DAY", True);
			StaticVarSetText("OrderID"+Name(), OrderID);
		}
	}
}
if(LastValue(Short) OR LastValue(Sell)) {
	if(ibc.IsConnected()) {
		if(ibc.GetPositionSize(Name()) == 0) {
			OrderID = StaticVarGetText("OrderID"+Name());
			ibc.PlaceOrder(Name(), "SELL", qty, "MKT", 0, 0, "DAY", True);
			StaticVarSetText("OrderID"+Name(), OrderID);
		}
	}
}
if(!toggleTradeTime) {
	if(LastValue(TimeNum()) == 160000) {
		ibc.CloseAllOpenPositions();
		ibc.CancelAllPendingOrders();
	}
}
/////////

PlotOHLC(_O, _H, _L, _C, "Renko", colorDefault);
//Plot(_C, "Renko", colorDefault, styleCandle);
Plot(TenkanSen, "CL", colorBlue, styleLine | styleThick);
Plot(KijunSen, "BL", colorRed, styleLine | styleThick);
Plot(ChikouSpan, "Lag", colorGreen, styleLine, Null, Null, -26);
//Plot(_ChikouSpan, "Lag", colorGreen, styleLine, Null, Null, 0);
//Plot(ChikouSpan, "Lag", IIf(ChikouSpan > IIf(SenkouSpanA > SenkouSpanB, SenkouSpanA, SenkouSpanB), colorGold, colorGreen), styleLine, Null, Null, -26);

Plot(_atr, "ATR", colorDefault, styleOwnScale | styleNoDraw | styleNoLabel);
PlotOHLC(SenkouSpanA, SenkouSpanA, SenkouSpanB, SenkouSpanB, "", IIf(SenkouSpanA > SenkouSpanB, ColorRGB(150, 255, 150), ColorRGB(255, 150, 150)), styleCloud, Null, Null, 26);
//PlotOHLC(_SenkouSpanA, _SenkouSpanA, _SenkouSpanB, _SenkouSpanB, "", IIf(_SenkouSpanA > _SenkouSpanB, ColorRGB(150, 255, 150), ColorRGB(255, 150, 150)), styleCloud, Null, Null, -52);
//PlotOHLC(SenkouSpanA, SenkouSpanA, SenkouSpanB, SenkouSpanB, StrFormat("| A = %g | B = %g |", SenkouSpanA, SenkouSpanB), IIf(SenkouSpanA > SenkouSpanB, ColorRGB(150, 255, 150), ColorRGB(255, 150, 150)), styleCloud, Null, Null, 26);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, _L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0, _L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0, _L, Offset=-45);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, _H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0, _H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0, _H, Offset=-45);

PlotShapes(IIf(Cover, shapeCircle, IIf(Sell, shapeCircle, shapeNone)), IIf(Cover, colorRed, colorGreen), 0, IIf(Cover, _L, _H), -20);