Thursday, 26 January 2012

> Amibroker AFL writing

Simple Amibroker Formula Language (AFL) (Ver.2)

Sample chart enclosed

Sample Chart selected with the following
Price Style             : Average
Order Type           : Point And Figure
Candle/Bar color   : Yellow
Background           : Teal
Top                       : Red
Bottom                  : Blue
Title Back Ground : Dark Blue

The following AFL is to combine Price Style, Order Type,Top color-Bottom color(Background color) and Title Back ground color.

By price style I mean Open,High,Low and Close with Average,Volume and Open Interest(OI)
By order type I mean Line,Candle,Bar,Histogram,Staircase,Swing Dots etc.
By Color type I mean you can use your custom and default colors in Amibroker.

There are three different AFLs for the above functions but i have combined all the above
three in a single AFL.

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
fld=ParamField("price Style",-1);
stl=ParamStyle("Order Type", defaultstyle=styleBar,mask=maskAll);
Plot( fld, "", ParamColor("Candle/Bar Color", colorWhite),stl);
SetChartBkColor( ParamColor("Background", colorBlack) );
Topcolor=ParamColor("Top", colorBlack);
Bottomcolor=ParamColor("Bottom", colorBlack);
Titlebkcolor=ParamColor("Title Background", colorBlack);
SetChartBkGradientFill( Topcolor, bottomcolor, titlebkcolor);

Small note to apply AFL : Copy the above indicator - Open file editor
it looks almost like notepad  and Paste the text in the window
and hit apply or insert indicator.

No comments:

Post a Comment