Skip to main content

MACD Candles for Amibroker (AFL)

stanwell over 16 years ago Amibroker (AFL)

  • Rating:
    4 / 5 (Votes 2)
  • Tags:
    macd, oscillator, amibroker

Draw MACD in candlestick shape. Apart from the normal signals, one can get an additional one: inside bar, which is earlier than crossovers.

Screenshots

Indicator / Formula

Copy & Paste Friendly
// MACD Candles 

_SECTION_BEGIN( "Standard MACD" );
ShortPds = Param("Fast period", 12, 1, 50, 1 ); 
LongPds  = Param("Slow period", 26, 3, 50, 1 ); 
aperiod  = Param("Signal period", 9, 1, 30, 1 ); 

ml = MACD( ShortPds, LongPds ); 
sl = Signal(ShortPds, LongPds,aperiod); 

InsideMacd = 	(sl < Ref(sl , -1) AND
				ml  > Ref(ml, -1)) OR
				(sl > Ref(sl , -1) AND
				ml  < Ref(ml, -1)) 
				;
 
Color = IIf( InsideMacd, ParamColor("Inside bar", colorBlack), IIf(sl > ml, ParamColor("up bar", colorGreen), ParamColor("down bar", colorBlack)));
PlotOHLC(ml, sl, ml, sl, "", color, styleCandle);

_SECTION_END();

1 comments

Leave Comment

Please login here to leave a comment.