Skip to main content

MACD colored for Amibroker (AFL)

sweetncu about 16 years ago Amibroker (AFL)

  • Rating:
    5 / 5 (Votes 1)
  • Tags:
    macd, trading system, amibroker, histogram

Its a better Macd indicator than simple macd histogram with good buy sell arrows.

Screenshots

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("MACD coloured");
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );

mm = MACD(r1, r2);
ms = Signal(r1, r2, r3);
mh = mm-ms;
mc = IIf(mh>Ref(mh,-1),IIf(mh > 0,27,41),IIf(mh > 0,43,32));

Plot(mm,StrFormat(_SECTION_NAME()+"(%g,%g)", r1 ,r2),12,4);
Plot(ms," Signal" + _PARAM_VALUES(),11);
Plot(mh,"MACDHistogram",mc,6|styleNoTitle|32768|4096);
Plot(mh,"MACDHistogram",mc,5|styleNoTitle|32768|4096);
Plot(0,"zero",colorBlack,styleLine);
Plot(mm,StrFormat(_SECTION_NAME()+"(%g,%g)", r1 ,r2),12,4);
Plot(ms," Signal" + _PARAM_VALUES(),11);
Plot(mh,"MACDHistogram",mc,6|styleNoTitle|32768|4096);
Plot(mh,"MACDHistogram",mc,5|styleNoTitle|32768|4096);

Buy= Cross(mm,ms );
Sell=Cross(ms,mm );

shape = Buy * shapeUpArrow+ Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorBlue, colorRed ), 0, IIf( Buy, ms,ms ) );
_SECTION_END();

2 comments

Leave Comment

Please login here to leave a comment.