Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
Find Out More Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Renko Chart for Amibroker (AFL)
kaiji
over 7 years ago
Amibroker (AFL)

Rating:
3 / 5 (Votes 2)
Tags:
amibroker, renko

Plot renko chart. Error in plotting will occur if the box and/or reversal values are too small causing the number of renko bars exceeding the underlying stock normal price bars.

By Graham Kavanagh – gkavanagh [at] e-wire.net.au

Screenshots

Similar Indicators / Formulas

Kavach Of Karna v2
Submitted by hbkwarez over 3 years ago
Advanced Elliott Waves
Submitted by MarcosEn almost 6 years ago
3_6Day GuaiLiLv
Submitted by motorfly almost 6 years ago
Williams Alligator system
Submitted by durgesh1712 about 6 years ago
Interactive Linear Regression Channel
Submitted by InternetWorm almost 6 years ago
*Level Breakout system*
Submitted by Tinych about 6 years ago

Indicator / Formula

Copy & Paste Friendly
// Renko  Chart
// Graham Kavanagh  13 Aug 2004 ver C
// Custom Indicator, date axis does not apply


 SetBarsRequired(10000,10000);

// Brick size is dependant on what you want, if too small will not produce a chart due to insufficient x-axis bars
//Brick = LastValue( ATR(100) );
//Brick = LastValue( Max(0.02*C, 0.05) );
Brick = Param( "Brick Size", 0.1, 0.01, 1.00, 0.01 );
reverse = 2;

// Convert the closing price to rising and falling rounded bricks
CF = ceil(C/Brick);
CR = floor(C/Brick);

// initialize first element
j = 0;
RKC[j] = CF[0];
RKO[j] = CF[0] + 1;

down[j] = 1;  // By default the first bar is a down bar.
up[j] = 0;

// Loop to produce the Renko values in number of bricks

for( i=1; i<BarCount-1; i++ )
{
if( CF[i] <= RKC[j] - 1 && down[j] ) // Continue down
	{
		num = RKC[j] - CF[i];
		for( x=1; x<=num; x++ )
		{
			j++;
			up[j] = 0;
			down[j] = 1;
			RKC[j] = RKC[j-1] - 1;
			RKO[j] = RKC[j] + 1;
		}
	}
	else
	{
		if( CR[i] >= RKC[j] + Reverse && down[j] )  // Change down to up
		{
			num = CR[i] - RKC[j];
			j++;
			up[j] = 1;
			down[j] = 0;
			RKC[j] = RKC[j-1] + 2;
			RKO[j] = RKC[j] - 1;			
			for( x=2; x<=num; x++ )
			{
				j++;
				up[j] = 1;
				down[j] = 0;
				RKC[j] = RKC[j-1] + 1;
				RKO[j] = RKC[j] - 1;
			}
		}
		else
		{
			if( CR[i] >= RKC[j] + 1 && up[j] ) // Continue Up
			{
				num = CR[i] - RKC[j];
				for( x=1; x<=num; x++ )
				{
					j++;
					Up[j] = 1;
					Down[j] = 0;
					RKC[j] = RKC[j-1] + 1;
					RKO[j] = RKC[j] - 1;
				}
		 	}
		 	else
		 	{
			 	if( CF[i] <= RKC[j] - Reverse && up[j] )  // Change up to down
			 	{
				 	num = RKC[j] - CF[i];
				 	j++;
					Up[j] = 0;
				 	Down[j] = 1;
				 	RKC[j] = RKC[j-1] - 2;
				 	RKO[j] = RKC[j] + 1;
				 	for( x=2; x<=num; x++ )
				 	{
					 	j++;
					 	up[j] = 0;
				 		down[j] = 1;
				 	 	RKC[j] = RKC[j-1] - 1;
				 	 	RKO[j] = RKC[j] + 1;
					}
				}
			}
		}
	}
}


// move the chart to right end of chart space, ie last brick on last bar position
delta =  BarCount-1 - j;

RKC = Ref( RKC, -delta );
RKO = Ref( RKO, -delta );

Up = Ref( Up, -delta );
Down = Ref( Down, -delta );

/*
rC = RKC * Brick;// + (Up-down)*Brick/2;
rO = RC - (Up-down)*Brick;
rH = Max(rC,rO);
rL = Min(rC,rO);
*/


C = RKC * Brick;// + (Up-down)*Brick/2;
O = C - (Up-down)*Brick;
H = Max(C,O);
L = Min(C,O);

Plot( C, "", colorGrey50,styleCandle); 
// plot chart
//plotOHLC( rO, rH, rL, rC, "Renko Price " , colorBlack, styleCandle);
GraphXSpace=5;

Title = Name() + " - {{INTERVAL}} {{DATE}} - Renko Chart : Last Value = " + RKC * Brick + ", Brick Size = " + Brick;

8 comments

1. jack234

giving error LN 55 col 9

2. administrator

jack this formula sometimes gives an out of bounds error this is a known problem you need to change the brick size until it doesn’t.

3. ford7k

Hi

you can code a afl line such that whatever setting you found by trial and error is chosen by code.
Suppose for nifty futures you found renko bricksize =7, then you can write a code line
using if or switch statement.
then the code once it detects nifty symbol, it selects bricksize 7.
you can add any number of lines for any symbol.

the concept is
If symbol is nifty,bricksize=7
if symbol =LT, bricksize =3

somebody can add this code line.

chers

4. cadoize

there is 32 errors

5. acchiang

Is there any update on this formula ? still not working

6. narun1982

getting error, can some one provide correct working code please

7. bsedoha

Can any body modify this as per new version ??

Thanks in advance.

8. bsedoha

Need help .. Can anybody help on this formula ..

Regards

Leave Comment

Please login here to leave a comment.

Back