Thursday, 29 January 2015

Amibroker AFL #1

Amibroker AFL is the sweetest ever language that I have encountered. I started my trading software exploration with Metastock way back in 2008. And since 2009 sticked to Amibroker due to its simplicity and user friendliness.

Amibroker AFL - How To Write It?

Those who are familier with languages like C++ will find great similarity in Amibroker AFL (Amibroker formula language). Simply you need to define variables and use your logic with the variables and constants. Use a ; sign after each statement.

Here I will show you a basic Amibroker AFL of coloured RSI. Copy and paste the below lines and insert into your amibroker formula editor.

_SECTION_BEGIN("StockManiacs.net RSI");
RP = Param("RSI",7,2,20,1);
UL= Param("Upper Limit",80,0,100,1);
LL= Param("Lower Limit",20,0,100,1);
PlotGrid(UL,colorBlue);   
PlotGrid(LL,colorBlue);
R= RSIa(C, RP);
Plot(R, "RSI",  colorBlue, styleLine);
Plot(UL,"Overbought Zone",colorRed);
Plot(LL,"Oversold Zone",colorGreen);

PlotOHLC( R,R,50,R, "", IIf( R > 50, colorRed , colorGreen ), styleCloud | styleClipMinMax, LL, UL );

_SECTION_END();

If you wish to see a professional Amibroker AFL of mine just check this post Amibroker AFL For Intraday – Only Trade Trending Stocks.

No comments:

Post a Comment