+91-0000000000

}

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

Directional Trend Index

This index helps assess the strength of a trend. An AFL code for Amibroker related to the Directional Trend Index calculates the strength of a trend, indicating whether it’s gaining or losing momentum.

/_SECTION_BEGIN("DTI");
r = Param( "Length", 25, 1, 100, 1 );
s = Param( "Smoothing", 13, 1, 100, 1 );

x = H - Ref(H,-1);

HMU = x > 0;
LMD = x < 0;

HLM = HMU - LMD;

//Plot(HLM, "", colorRed);

a = EMA(EMA(HLM,r),s);
b = EMA(EMA(abs(HLM),r),s);

DTI = 100 * (a/b);

Plot( DTI, "DTI("+r+","+s+")", ParamColor( "Color", colorRed ), ParamStyle("Style") );
PlotGrid(0, colorLightGrey);
PlotGrid(25, colorLightGrey);
PlotGrid(-25, colorLightGrey);
_SECTION_END();

Open chat
1
Hi, how can I help you?