+91-0000000000

}

Monday – Friday : 9:00 AM – 6:30 PM

Median Average Adaptive Filter

The Median Average Adaptive Filter AFL in Amibroker is a filter that adapts to changing market conditions by using median averages. Utilizing amibroker data feed  functionalities enables traders to filter out noise and identify smoother trends. This AFL aids in reducing volatility impact, providing clearer insights into market trends for more precise decision-making.

/
SetChartOptions(0,chartShowDates|chartShowArrows|chartLogarithmic|chartWrapTitle);
Price = ( H + L ) /2;
Threshold = 0.002;
Smooth = (Price + 2 * Ref( Price, -1 ) + 2 * Ref( Price, -2 ) + Ref( Price, -3 ) )/6;
Length = 39;
Value3 = 0.2;
AvgLength = 39;
for( Length = 39; Length >= 3; Length = Length - 2 )

{
   alpha = 2 / ( Length + 1 );
   Value1 = Median( Smooth, Length );
   Value2 = AMA( Smooth, alpha );
   Value3 = Nz( abs( Value1 - Value2 )/Value1 );
   AvgLength = IIf( Value3 > Threshold, Length, AvgLength );
}

alpha = 2 / (AvgLength + 1);

Filt = AMA( Smooth, alpha );

Plot( C, "Price", colorRose, styleCandle );

Plot( Filt, "Filt", colorRed );

Open chat
1
Hi, how can I help you?