Skip to main content

Plugins are game-changers in expanding Amibroker’s capabilities. With the power of custom coding in C++ or C#, wrapped in a DLL and integrated via the Amibroker Development Kit (ADK), the possibilities are endless. This article will guide you through creating an Amibroker AFL DLL plugin, step by step.

Discover how to transform any AFL into a DLL in the second part of this series.

Before diving in, let’s demystify what a DLL is.

As Techopedia explains, “A dynamic link library (DLL) is a shared program module… that may be dynamically called by an executing program during run time.

In layman’s terms, a DLL is a collection of programs with specific logic, packaged as an executable file for integration with applications like Amibroker, akin to a JAR file in Java.

Related Reading: Amibroker Custom Backtester: A Step-by-Step Guide

Using .NET with Amibroker

We’ll be using Dot Net for Amibroker in this and future tutorials. This SDK enhances the standard Amibroker development experience, allowing you to code in your preferred .NET language without the complexities of native C/C++.

While not a replacement for ADK, Dot Net for Amibroker simplifies development with its reusable interfaces, albeit with a cost attached. However, free and trial plans are available.

Let’s begin by outlining the prerequisites and steps for creating your first Amibroker AFL DLL plugin.

Getting Ready

  • Ensure you have the latest version of Amibroker installed. Visit this link for details.
  • Install the Visual Studio community edition from here.
  • Get .Net for Amibroker compatible with your Amibroker version from this link.

Watch this video for installation guidance: Installation Tutorial.

A basic understanding of Amibroker AFL and Visual C# is also essential for this tutorial.


Creating an Amibroker AFL DLL Plugin

After completing the prerequisites, follow these steps to create a new Amibroker AFL DLL plugin:

Step 1: Check for a folder named “.Net for Amibroker” in your Amibroker installation directory.


If it’s missing, you might need to reinstall .Net for Amibroker.

Step 2: Open Microsoft Visual Studio and choose ‘Open a Project or Solution’.


Find the SamplePlugInCS project and open it.


Step 3: Explore the sample project in the solution explorer.


Step 4: Start by reviewing the C# code in Basic Samples.cs.


Step 5: Add a function to the BasicSample class to plot a candlestick chart with a 20-period exponential moving average.

        public void PriceWithEMA()

            ATArray myFastEma = AFAvg.Ema(Close, 20);

            AFGraph.Plot(myFastEma, "Ema5", Color.DarkBlue, Style.Line);

            AFGraph.PlotOHLC(Open, High, Low, Close, "Close", Color.Red, Style.Candle);

Step 6: Build the solution in Visual Studio.


Step 7: Restart Amibroker and create a new AFL to call the PriceWithEMA function.

					_SECTION_BEGIN("Price with EMA DLL");




Save and load this AFL on a chart to view the Price with EMA chart.


These steps guide you in creating an Amibroker AFL DLL Plugin. Dive deeper into the SamplePlugInCS project for more advanced examples.

Need help or have suggestions? Let us know in the comments section.