.

Perfect Moving Average Trend Line - Amibroker AFL Code

Click Image To Enlarge. Please Rate And Comment.

Perfect Moving Average Trend Line

_SECTION_BEGIN("AccDist");
Plot( AccDist(), _DEFAULT_NAME(), ParamColor("Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();

_SECTION_BEGIN("MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); 
_SECTION_END();

Buy = (AccDist() > MA(AccDist(),28)) AND (Ref(Close,-1) > EMA(Close,34));
PlotShapes( IIf( Buy, shapeDownArrow + shapePositionAbove, shapeNone ), colorGreen );
AlertIf( Buy, "SOUND C:\\Program Files\\AmiBroker\\Formulas\\ARB Main Indicators\\Chimes.wav", "Buy  " + Name(), 1, flags=4, Lookback=1 );

Sell = (AccDist() < MA(AccDist(),28)) AND (Close < EMA(Close,34));
PlotShapes( IIf( Sell, shapeUpArrow + shapePositionAbove, shapeNone ), colorRed );
AlertIf( Sell, "SOUND C:\\Program Files\\AmiBroker\\Formulas\\ARB Main Indicators\\siren.wav", "Sell " + Name(), 2, flags=4, Lookback=1 );

Buy = ExRem( Buy,Sell );
Sell = ExRem( Sell,Buy );
Previous Post Next Post