Skip to main content

Displaced Moving Average Channel for Amibroker (AFL)

dogma about 16 years ago Amibroker (AFL)

  • Rating:
    4 / 5 (Votes 2)
  • Tags:
    amibroker, moving average, channel

Using styleCloud plot style in Amibroker, plots a DMA (Displaced Moving Average) of the price. To compare price against DMA Channel, use “Overlay” to add this indicator on top of price plot or uncomment the last line. Default values of 6 period Simple MA and 4 period “forward shift” , with parametrization to support different values. For usage information see http://www.erlangerresearch.com/wpDMA4.asp

Indicator / Formula

Copy & Paste Friendly
Type = ParamList("Type", "Simple,Exponential,Double Exponential,Tripple Exponential,Wilders,Weighted");
Periods = Param("Periods", 6, 2, 300 );
Displacement = Param("Displacement", 4, -50, 50 );
m1 = 0;
m2 = 0;

if( Type == "Simple" ) {					
	m1 = MA( H, Periods );
	m2 = MA( L, Periods);
}
if( Type == "Exponential" ) 			{					
	m1 = EMA( H, Periods );
	m2 = EMA( L, Periods);
}

if( Type == "Double Exponential" ) 	{					
	m1 = DEMA( H, Periods );
	m2 = DEMA( L, Periods);
}

if( Type == "Tripple Exponential" ) 	{					
	m1 = TEMA( H, Periods );
	m2 = TEMA( L, Periods);
}

if( Type == "Wilders" ) 				{					
	m1 = Wilders( H, Periods );
	m2 = Wilders( L, Periods);
}

if( Type == "Weighted" ) 				{					
	m1 = WMA( H, Periods );
	m2 = WMA( L, Periods);
}


Plot( m1, _DEFAULT_NAME(), ParamColor("ColorTop", colorGreen), ParamStyle("Style"), 0, 0, Displacement );
Plot( m2, _DEFAULT_NAME(), ParamColor("ColorBottom", colorRed), ParamStyle("Style"), 0, 0, Displacement );

PlotOHLC(m1,m1,m2,m2,"DMACloud",ParamColor("ColorChannel", colorYellow),styleCloud,Null,Null,Displacement);
// Uncomment line below to plot price if Indicator is not overlaid a Price chart
//Plot(C,"Close",colorBlack,styleCandle);

0 comments

Leave Comment

Please login here to leave a comment.