Pages

Friday, November 16, 2012

Mass Index-AFL Code for Amibroker

Mass Index is a very popular indicator and is extensively used for technical analysis in the financial markets.

Those who use Amibroker mostly apply this indicator . However it may happen accidentally that the AFL used for Mass Index is deleted from the software. This brings in a lot of trouble for those who might not be very much familiar with the coding process.

To overcome this problem I am posting the AFL for the indicator here which can be copied from here then applied in the Amibroker software through the Formula Editor .


=============================Copy The Code From Below======================

_SECTION_BEGIN("Mass Index");
function MassIndex( period1, period2 )
{
 diff = H - L;
 ediff = EMA( diff, period1 );
 eediff = EMA( ediff, period1 );
 return Sum( ediff/eediff, period2 );
}

Plot( MassIndex( Param("Period 1", 9, 2, 100 ), Param("Period 2", 25, 2, 100 ) ),
      _DEFAULT_NAME(), ParamColor("Color", ColorCycle ) );
_SECTION_END();

========================================================================

No comments:

Post a Comment