# How to remove noise from Heikin Ashi further

Hi there,
I have to remove residual noise from Heikin Ashi Indicator.
I have already tried traditional Heikin Ashi using AMA & using arrays also.
I have to essentially put BUY/SELL signal over every change of color, please assist.
Any rudimentary idea is also welcome.
Thank you.

Hi there,
I have to remove residual noise from Heikin Ashi Indicator.
I have tried traditional Heikin Ashi using AMA & using arrays also.

1. Following code I tried for AMA_
``````SetChartOptions(0,chartShowArrows|chartShowDates);
GraphXSpace=5;
p=Param("Period",6,1,30,1);
Om=MA(O123,p);
hm=MA(H123,p);
lm=MA(L123,p);
Cm=MA(C123,p);
HaClose=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorWhite, styleCandle | styleNoLabel );
_SECTION_END();
``````
1. Following code I tried using Arrays_
``````NNClose[0] = (O123[0]+H123[0]+L123[0]+C123[0]) / 4;
NNOpen[0]  = (NNClose[0] + O123[0]) / 2;
NNHigh[0]  = Max( H123[0], Max( NNClose[0], NNOpen[0] ) );
NNLow[0]   = Min( L123[0], Min( NNClose[0], NNOpen[0] ) );

for (i=1; i<BarCount; i++)
{
NNClose[i] = (O123[i]+H123[i]+L123[i]+C123[i]) / 4;
NNopen[i]  = (NNClose[i-1] + NNOpen[i-1]) / 2; // Here is the problem when using Arrays: Haopen always uses its own previous value
NNHigh[i]  = Max( H123[i], Max( NNClose[i], NNOpen[i] ) );
NNlow[i]   = Min( L123[i], Min( NNClose[i], NNOpen[i] ) );
}
PlotOHLC( NNOpen, NNHigh, NNLow, NNClose, "NN", colorBlack, styleCandle );

``````

The outputs are much better then where I had started, but not convincing for & the best I could achieve was this_

Trying to remove the intermediate noise visible in between the trend so that chart becomes continuous.
My idea is to essentially put BUY/SELL signals over every logical change of trend (i.e. color).
e.g. Suppose BUY is started, it should not suddenly change to SELL within 2-3 candles & again revert to BUY.
Any rudimentary idea is also welcome.
Thank you.

You are using p=6

more the number less the noise in general

Hi Amsai,
Actually, I tried till 80 also. But then chart becomes unusable.
I think I there can be a method to pre-filter the input parameters again.

I guess you just need to define an inputvalue
which indicates the maximimum distance opposed
to the previously reached extreme value
to trigger a color change.
Then refer to the colors for buy and sell signals.

Hi!

A newbie question, the O123, H123 etc., what is this?
Should I initalize this, and if so?
O123 = Open?

/Leif