Skip to main content

Heikin Ashi for Amibroker (AFL)

kaiji over 16 years ago Amibroker (AFL)

  • Rating:
    3 / 5 (Votes 18)
  • Tags:
    amibroker, heikin

Heikin-Ashi Candlesticks are similar to normal Japanese candlesticks but with a few differences to eliminate some of the noise. Heikin-Ashi Candlesticks combine the open-close prices from the previous period with the open-high-low-close data from the current period to create a new candlestick chart type. By combining the two together the new candlestick chart is able to filter out some of the noise present in the price. Heikin-Ashi candlestick can be used to quickly identify periods of trend and potential points of reversal.

Screenshots

Indicator / Formula

Copy & Paste Friendly
SetChartOptions(0,chartShowArrows | chartShowDates);

HaClose = (O + H + L + C)/4; 
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 ); 
HaHigh = Max( H, Max( HaClose, HaOpen ) ); 
HaLow = Min( L, Min( HaClose, HaOpen ) ); 
xDiff = (HaHigh - Halow) * 10000;
barcolor = IIf(HaClose >= HaOpen,colorGreen,colorRed);
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "", barcolor, styleCandle );

25 comments

1. MTRIG
over 16 years ago

Heikin-Ashi is one of the best charts to look at to quicky determine the trend.

MTR Investors Group is the only web site where you can find Heikin-Ashi charts online.

Heikin-Ashi at MTRIG.com

2. avram
over 16 years ago

This is one of the best indicators I have come accross. Thanks.

about 16 years ago

This can’t be coded in Metastock. Metastock does not allow one to create custom charts.

over 15 years ago

IS IT POSSIBLE TO CHANGE THE COLOR OF THE CANDLE TO PLOT INTRADAY HIGH AND LOW IN A DIFFERENT COLOR OTHER THAN GREEN OR RED, SO THAT IT IS EASY TO SPOT WHEN INTRADAY HIGH AND LOW WAS FORMED.THANKS

10. Wach
about 15 years ago

Heikin-Ashi is great tool, if the trend is your friend then get this indicator. They bring youthful energy to old good candlesticks.

15. halfman
over 14 years ago

Heiken Ashi is a good and powerful indicator. To use it, you can try as I suggest.

1. When the trend is up, focus on candle’s body. I usually ignore the shadow since the body will give more informations. Whenever the body become smaller, it indicates weakening.

2. When the trend is down, focus on the candle’s shadow. I usually ignore the body since the shadow will give more informations. Whenever the shadow become longer, it indicates 2 signal : continuation or reversal.

Combine it with your other favorit indicator to get the best result. Hope this can be helpful.

FYI, don’t bother to consider Heiken Ashi as Japanese Candlestick because both works in quite different ways.

about 12 years ago

Hi,
Can someone tell me how to plot buy sell signals for heikin ashi?
Meanin that it buys when candle turns green and sell when red…

19. morgen
about 12 years ago

ritvikshankar, add this:

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//FORMULE
stochup= StochK()>StochD() ;
MACDup= MACD()>Signal() ;
Hist= MACD()-Signal() ;
Histup= Hist>Ref(Hist,-1) ;
HAup= HaClose>=HaOpen ;
BuyHa= HaClose>=HaOpen ;
SellHa= HaClose<HaOpen ;
//======================================================================

//PARAMTOGGLE

// This combines indicators into one timing Signal
//function ParamOptimize( description, default, minv, maxv, step )
//    { return Optimize(description, Param(description,default, minv, maxv, step ), minv, maxv, step ); }
tgl = ParamToggle("Result", "AND logic|Compare");
// switch test calculation and compare the results
if(tgl)
{
myBuy = BuyHa AND macdup AND histup AND stochup ;           
myShort = SellHa AND !histup AND !stochup ;            
}
else
{
myBuy   = IIf( HaClose>=HaOpen AND MACD()>Signal() AND Hist>Ref(Hist,-1) AND StochK()>StochD()      ,1,0) ;                                                                       
myShort = IIf( HaClose<HaOpen  AND Hist<Ref(Hist,-1) AND StochK()<StochD()     ,1,0);
} 

Buy = ExRem(mybuy,myshort);
Sell = ExRem(myshort,mybuy);

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,haLow,Offset=-15);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,haHigh,Offset=-15);
20. mjorg
over 11 years ago

Has anyone bought the CD “Heiken-Ashi How to trade without Candlestick Patterns” from this site:
http://www.educofin.com/index.html

If so is it worth it?

Thnx

Marty

over 10 years ago

HI

I added the buy and sell formula, but it gives error on lin3 35 Col 64.
Saying that Variable hihigh used without having been initialized.

Please acknowledge.

Thanks
Prakash Modak

over 10 years ago

Hi

Please ignore previous comment, now its working fine. I have just changed the variable same as (hiHigh to HiHigh) which you have assigned in main code.

can you help me in another logic? need help in designing AFL based on AROON.
please contact on prakash.modak65[at}gmail{dot]com
Thanks

over 10 years ago

Hi
Can some one tell me how to use two colors in on HA candle i.e. in down turn it Red and Green and in up trend its Blue & Green in the same candle. for reference you can see the the YouTube https://www.youtube.com/watch?v=zN712u1Ma5s
Please post me details if you have on prakash.modak65@gmail.com

about 10 years ago

morgen how simple u wrote that code for buy sell.. great.

I’m new to afl’s.

almost 7 years ago

add this to your code:

HaOpen = IIf(IsNull(HaOpen) OR IsNan(HaOpen) OR HaOpen==0 , Ref(HaOpen , 1) , HaOpen);

under HaOpen definition.

Leave Comment

Please login here to leave a comment.