AmiBroker Formula Language (AFL) is a sophisticated yet accessible scripting language that transforms AmiBroker from a charting platform into a complete algorithmic trading development environment. Whether you are creating custom indicators, building automated trading systems, or running portfolio-level optimizations, AFL provides the tools necessary to express any trading idea with precision and speed.
What specific (e.g., breakout, mean reversion) you are building Whether you need code for Intraday or End-of-Day (EOD) data
The Formula Editor is your primary workspace for writing AFL code. You can access it through the Tools menu or by right-clicking on any chart pane and selecting "Edit Formula". The Automatic Analysis window is where you'll run scans, backtests, and explorations.
A typical AFL script consists of several standard variables and functions that define the logic: Buy/Sell/Short/Cover amibroker afl code
Many developers share AFL code on GitHub. One notable example is a Relative Price Strength script that calculates and ranks stocks across customizable timeframes while integrating sector and industry information.
Advanced users can write plugin DLLs using C/C++, Delphi, or other languages. Plugin functions run several times faster than interpreted AFL and can call back AFL built-in functions, directly retrieve and set AFL variables, and support automatic syntax coloring for exposed functions.
The Alert function can be used to trigger alerts on buy and sell signals. AmiBroker Formula Language (AFL) is a sophisticated yet
The AddRankColumn() function creates dynamic rankings:
AFL's enduring relevance is a testament to its design. Unlike many proprietary platforms that limit user creativity, AFL provides a low-level, array-based programming environment that is both accessible to beginners and incredibly powerful for professionals. With the recent introduction of AI-driven tools like the AFL Code Assistant in AmiBroker 7, the ability to craft sophisticated code has never been more democratized.
IIf() : The array version of an immediate-if statement. It evaluates the condition across every data point in the array and returns corresponding array values. You can access it through the Tools menu
This finds stocks that have gained more than 3% in the last 5 days on above-average volume.
Data series like Close , Open , High , Low , and Volume . Operators: Mathematical ( −negative ) and logical ( >is greater than AND , OR ) operators.
// Plot Plot(ShortMA, "Short MA", colorRed); Plot(LongMA, "Long MA", colorGreen); PlotBuy(Buy, "Buy", colorGreen, styleShapeTriangleUp); PlotSell(Sell, "Sell", colorRed, styleShapeTriangleDown);
// Conditions for buy and sell Buy = Cross(ShortMA, LongMA); Sell = Cross(LongMA, ShortMA);
Create a question bank from scratch. Add pictures, tables and format text.
Upload a pdf containing a question bank that you previously made.
Restore a backup from a previous account or a friend.
Upload questions from any spreadsheet, just tell us where everything is.
Email: [sxvjJtweenquirUTMVdPcv]itTcp^BMu[es@nsLpR[xjlh]pMsYnQLTippotcrbuZJeRoraYvL\kMVpAinlECZvnIUq.rukbYaVv]com