Renko and heikenAshi Indicators

Hello Geeks,

I am in need of Renko and heikenAshi indicators, kindly share the afl with me.

Bharat R

Welcome to the Forum BR, I am happy to help but I notice that many forum members appear for 1 minute, ask for some free code help and then disappear until they need more codes.

I would hope that you could return after studying the following materials and contribute so that the rest of us can learn what you found during your research using the following codes. Advantages, disadvantages, success or failure, modifications etc.

Thanks, I hope these codes help you and I look forward to hearing from you.

If you want to learn about Heikin-Ashi I suggest reading the books by Dan Valcu, the brains behind the Heikin-Ashi technique

AmiBroker afl based upon Dan Valcu original TASC article

Previous discussion in old AB user forum,

More articles from TASC that incorporate H-A

Renko Bars, code from two articles in TASC


Hello, thanks for all the information you provided, well I am a beginner in this field of technical trade and analysis and I am searching my way out.
The links provided does explain me some of it, however I would do an in-depth research in it.
Also I see we have a Yahoo group, could you provide me access to this restricted group? my yahoo id is
Bharat.r87 – at –

Bharat R.

Moderator comment: Really if you don’t want spam bots to take your email and flood with spam never ever type plain text email addresses on public forum (I edited your email already)

Contact support -.- at -.- amibroker com

Hello everyone,

This particular code below, does not match with the price data. I have tried the modified version also.
Can some one offer their view on this.

Renko Bars, code from two articles in TASC


How can I plot candles like renko, ie without wick?

eduardo baralhão medeiros

@baralhao - do not create duplicate topics on SAME subject. If everyone does what you did, we could easily get 200 topics about “renko”. And 200 duplicate topics about ANY subject. And that would make forum unusable. Use Search before posting and use EXISTING threads.

I came to the forum to ask for help, never with the intention of creating confusion or multiple topics.

I searched several times in the forum about renko and found the post posted by you:

Assumptions are NOT facts.

The facts are that Renko bars are basically just RANGE bars. It is 100% the same concept. And Range bars ARE available in AmiBroker.

I tested the two codes available on the links below, none of them worked for my need.

Whereas I use “range bars” instead of AFLs of renko, how to get the candles behave like the renko, ie without wicks? Is there any configuration in Amibroker that shows the candles as I need them? Is it necessary to build an afl?

English is not my native language, so please excuse me for some inaccuracy

eduardo baralhão medeiros

This formula that was pointed to you and you just ignored it

ALREADY show PRECISELY how to plot candles without wicks. So re-read the code. The answer is ALREADY there, in the formula.


This is one example how to display Renko.

As to range bars see Knowledge Base:


I ask you to calm your heart because I am not fighting with you. If for some reason you felt uncomfortable with my text, I beg your humble apologies.

The problem is that I did not find the answer to my questioning. The afl you recommended does not work properly as each candle has a different size than the brick size.

I was happy to know that the Amibroker has the Range Bars and it would be perfect as it keeps the candle the size of the brick. The problem is that it is not shown as in other tools, ie without wicks.

I come to the conclusion that the Range Bars solution is not enough and that I need to build an afl to handle the candles. It is? Do I need to program?

You indicated that the solution is in the uploaded link, but I do not know how to isolate the part of the candles from the rest of the code. Is it possible to show another example more focused on candles?

Once again, thank you and I ask that you understand that I did not intend to attack. I also ask you to consider my text, because as I said in a previous message, English is not my language.

Eduardo Medeiros

hello @baralhao
Below code it is for just about the wicks you keep asking, and you can use the PlotOHLC function

 // below code is just about the wicks using the PlotOHLC() function
 // just uncomment ONE line with the PlotOHLC() function to see and to find out how works
// styleBar with Open, high ,close
// PlotOHLC( Null,H,L,C, "", colorDefault, styleBar|styleThick ); 

// styleBar with Open, high ,close and title
//PlotOHLC( Null,H,L,C, "H:" +H +" L:" + L + " C:", colorDefault, styleBar ); 

// styleBar with Open, high ,close and color
// PlotOHLC( Null,H,L,C, "",  IIf( Close >= Open, colorGreen, colorRed ), styleBar );

// styleBar with Open, high ,close and thick bars
// PlotOHLC( Null,H,L,C, "", colorDefault, styleBar,Null, Null, 0, 1, -35 /*Ver:5.52, line width as percent of bar */  ); 

// styleCandle with high ,Low  
// PlotOHLC( H,H,L,L, "", colorDefault, styleCandle );

// and so on.....
1 Like

Thanks @PanoS

Very useful

Eduardo Medeiros

Hi @Tomasz, @PanoS,

I have tried this formula, have some dis-consistency when compared with other platform Renko charts, but seems can still be used to scan the price actions. I was trying to modify this code for auto brick levels as percent of last price level of stock, as

Brick= percnt * Ref ( C, -1 ) ; “percnt” is variable I can input to select percentage of recent stock price

but the chart goes blank, I also tried other things based on MA and ATR functions but nothing works, any idea how to do ?

this many AB experts here and out in world and no ideas yet…?!


there is a bug at

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

if either Close or Brick becomes Zero then it will be unpredictable. Brick Can’t be Zero.

  1. Close price by definition is not zero (ASCII importer does not allow to import prices <= 0).
  2. Brick size also by definition should be greater than zero. If you are calculating it you must make sure it is so, by for example using: Brick = Max( 0.01, Brick );
1 Like

@Tomasz, @phb, I tried following but still chart goes blank without any error message,

Brick = Max( 0.01, (0.01 * Ref ( C, -1 )) );

I believe, this is because following part of code is replacing original OHLC data by AFL calculated RKx variables,

C = RKC * Brick; 
O = RKO * Brick; 
H = IIf( modified, RKH, Max( C, O ) ); 
L = IIf( modified, RKL, Min( C, O ) );

that is why Brick needs to be independent of Close price, pls confirm and if so, can’t we use PlotOHLC to avoid this replacement ? (I tried with rC, rO etc but the chart was giving strange levels)
also,is this AFL plotting Renko bricks from right to left ? (just thinking bcos it refers to last Price Close level for Variable initialization)

btw, why CF and CR is required ? can’t we do brick conversion without that, direct with price levels ?

@Tomasz, for my understanding pls confirm that the whole AFL code is repeated every time the new price level is received (where can I find info on AB code execution process for ref. ?)