Thursday 5 March 2015

MACD and Histogram with Good Understanding afl for amibroker

MACD and Histogram with Good Understanding afl for amibroker



//asfatul.alam@yahoo.com

 _SECTION_BEGIN("MACDval");
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );

dynamic_color = IIf( MACD() > 0, colorGreen, colorRed );
Plot( MACD(), "MACD(12,26)", dynamic_color, styleHistogram | styleThick );

_SECTION_BEGIN("SIGNALval");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( EMA( MACD(12,26),9 ),"signal 9",colorYellow,styleHistogram |styleThick, ParamStyle("Style") );


MACDval = MACD(12,26);
EMAval = EMA(Close,9);
Signalval = Cross(EMAval,MACDval);

Buy = C > EMA(Close,200) AND Ref(MACDval,-1) < MACDval AND MACDval < 0;

Sell= Signalval;

Buy= ExRem(Buy,Sell);
Sell= ExRem(Buy,Sell);

No comments:

Post a Comment

Thanks