A function with multiple return values
A typical AFL function returns one value. For example sin( x ) returns sine value of argument x. Sometimes however it is useful and/or required to return more than one value from the function....
View ArticleDo NOT make assumptions on number of bars
From time to time some users face “Error 10. Subscript out of range” in their formulas. The error itself is described in the manual, but still a few words of explanation why it happens may be useful....
View ArticleCan I encrypt my formula so no-one can decipher it?
Currently the only way to protect your code from other peoples’ eyes is to translate part of the formula (such as few functions) or entire formula to C/C++ language and compile as AFL plugin DLL. Doing...
View ArticleWhat are constants in AFL and how they work
The AFL language contains many pre-defined words like: shapeUpArrow, stopTypeTrailing, colorRed, styleThick, inDaily and many more. These are examples of constants. As written in AFL language...
View ArticleWhen and how often AFL code is executed?
All analysis in AmiBroker including charting, Analysis window or commentaries is based on underlying AFL code, which is being executed by the program to produce the required output. Therefore – any...
View ArticleChecking relationship between multiple moving averages
When we compare the positions of several lines against one another, we need to remember about using correct operators, so our AFL statement return correct results. Let us consider a set of moving...
View ArticleHow to populate Matrix from a text file
AmiBroker 6.00 has introduced support for matrices. After we create a matrics with Matrix function call: my_var_name = Matrix( rows, cols, initvalue); then in order to access matrix elements, we need...
View ArticleHow to fix Error 61 in printf/StrFormat calls
AmiBroker version 6.07 has introduced a strict check for correct string formatting in printf and StrFormat functions. These functions allow to specify the string followed by the list of arguments that...
View ArticleHow to count symbols in given category
When we want to find out how many symbols belong to given category (such as watchlist) then for manual inspection, it is enough to hover the mouse cursor over the particular category name in the...
View ArticleCalling custom user functions in our code
AFL language allows us to define reusable functions that can be used in our formulas. The following chapter of the manual explains the procedure in details:...
View Article