Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

How to Create Your First Amibroker DLL Plugin?

2 min read

This is a very simplistic tutorial which explains how to create your own Amibroker DLL Plugin using Dot Net for Amibroker.  .Net for Amibroker is a 3rd Party SDK to Amibroker which you can use to create plugins to hide your secret afl codes, creating optimizers, data source plugins and it supports all programmable features of AmiBroker.

 
Who Should go for DLL Plugin?

1)By default Amibroker doesn’t have AFL source code protection mechanism. If you are planning to secure your secret mathematical model from others or license it and sell it to your customers.
2)Planning for Automation in Amibroker (Report Generation, Data Plugin Creation, GUI based automation). For Example TradeSender is amibroker automation program which push notification alerts to your Android Smart Phone.

Dot net for Amibroker comes with three edition(Developer, Standard and Free Edition). And the Developer Edition comes with Default templates. If you are planning to test it out then it is recommended to Install Developer Edition. .NET for AmiBroker – Developer Edition and .NET for AmiBroker – Standard Edition have a 30 days trial period. You need to have the following Skill Sets and Tools listed below

1)Amibroker Software
2)Microsoft Visual Studio. You can try out the visual studio community edition if you are an individual developer and can create paid or free apps. And Organizations can use it for contributing to open source projects, Research or in a classroom learning environment. Visual Studio Community 2013 includes all the great functionality of Visual Studio Professional 2013, designed and optimized for individual developers, students, open source contributors, and small teams.
3)Dot Net SDK for Amibroker
3)Knowledge on Amibroker AFL Programming
4)Knowledge on VC# or Visual Studio and SDK concepts.

Steps to Create your First Amibroker Plugin

1)Download the Dot Net SDK for Amibroker according to your 32bit or 64bit Amibroker Edition and Amibroker Version.
2)Open Visual Studio-> Goto New Project
3)On the Left Side Pane Goto Tempaltes -> Visual C# -> Amibroker and select Amibroker Plugin template on the right side pane
4)Now select the name of the plugin in this example it is SimplePlugin as shown below and press Ok Button

Amibroker Plugin

5)After Pressing OK it opens the default sample template which is nothing but a simple moving average function as shown below. Instead you can write your own custom functions which has to be hidden from the public.

https://gist.github.com/3010bcc7dc17559ef180

6)Now Build the Solution or Alternatively you can press the key CTRL+SHIFT+B

Dot Net for Amibroker

This attempt will create the dll plugin files under /Amibroker/.Net for Amibroker/Assemblies where are your converted dll files has to be placed.

Dll plugin files

The Build attempt It also creates the converted AFL file which refers the dll secret functions. The AFL files are stored under /amibroker/formulas/.Net for Amibroker/SimplePlugin as shown below.

Plugin Indicator

You can notice that now SimplePluginFunc1(Close, 5); is highlighted in blue text which means amibroker recognizes the function now and refers the custom dll files.

https://gist.github.com/f58bc0471b0973c17f10

Bingo Now you are done and now you can use the custom secret function in your regular afl files and your logic always remains hidden in the dll functions. Sample AFL shown below which plots the simple moving average which refers the secret logic SimplePluginFunc1

https://gist.github.com/1eaa88e876c2368f987c

Simple DLL Plugin Output

For creating your own custom functions it is recommended go thro the tutorials in .Net SDK for Amibroker. It is recommended to be familiar with Amibroker, Visual Studio(C#, VB.Net) and .Net SDK Functions.

Now to License your DLL files and sell it to customers with Hardware Protection Lock or with expiry dates and licensed your .Net dll plugin by commercial protection tools like IntelliLock, CliSecure Licensing, .NET Licensing Pro, etc

Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

Algomojo Index Straddle/Strangle Execution Module with Intraday Stoploss

This tutorial focus on how to automate your index straddle/strangle strategy with intraday stop-loss levels with time-based entry and exits using Algomojo Platform and...
Rajandran R
7 min read

Learn How to Login into Algomojo Account using Amibroker

In the last tutorial, we learn how to automate the algomojo login process and in this video tutorial, we are going to learn with...
Rajandran R
1 min read

Amibroker Execution Module – Hedged Index Futures for Directional…

In the last tutorial, we learn the importance of Hedging Futures Position with OTM Options for Reduced Margin. This tutorial focus on how to...
Rajandran R
14 min read

33 Replies to “How to Create Your First Amibroker DLL Plugin?”

    1. No you cannot use the Ninja DLL’s in Amibroker as it Support only Ninjatrader Functionality. Cross Porting is not possible between Ninjatrader and Amibroker.

  1. Dear Rajandran,

    Nice one, i think if any one is not friendly to coding software skills can use it. Great Work.

    Could you share more info on making great strategy with a good accuracy and also when you are planning your session in Ahmedabad.

    Love to see you.
    Sumit Jain

    1. Sure the blog mostly focus on strategy which has atleast little edge in the market. As of now this year it is concerned we are not planning in Ahmedabad.

      1. Hi

        When blog is focusing on Strategy development,I am putting an idea to it.
        Is it possible to develop any good strategy and Scanner based on tape reading analysis in Amibroker5.80/5.90 32bit with backtesting and forwardtesting option in one click ?

        As tape reading is coming to a next big thing for Lower Time Frame Scapler/Swing trading I would request to focus in such part also (nothing developed in such area)

        thanks in advance And waiting for your comments.

    1. Have a nice try. A Good Way to Secure your source code. Really feels like amibroker should have some sort of mechanism inbuilt to secure the code to some extent

  2. Dear sir,
    can you please explore how we can add ami-broker template to visual studio 10 i tried it several time to do but failed.
    i am not able to find amibroker template for visual studio.

  3. Dear Sir
    can you please tell me how can we install amibroker template to visual studio 10.
    i am not able to find ami broker template in visual studio.
    1)Download the Dot Net SDK for Amibroker according to your 32bit or 64bit Amibroker Edition and Amibroker Version.
    2)Open Visual Studio-> Goto New Project.
    i completed step 1 but i got stuck at step 2.
    please help me with the same

  4. I have a “n reversal afl ” it gives late signals if you modify or deveplope exact signal , how can contact you Sir.

  5. Dear Sir,

    When i building project it is giving an error that:—- A namespace can not directly contain members such as fields or methods. how to solve the issue

  6. Hi Rajendran,

    AFL is a limited language in the sense that it doesnt support everything that a high level programming language like C++ or Java supports , like there are no Classes .

    I want to write a stragey thats pretty complex and with my attempt with so far with AFL its been difficult because of various limitations of AFL , like limited data types. Can these be overcome with the help of plugins ? can we write classes in plugin ?

    Are all AFL functions available while writing plugins ? ( like HHV , Plot , LLV etc )

  7. Recently sharekhan have provided api access to me . Now i want automatic order placement in trade tiger from amibroker. i have taken the trail of GFDL plugin.. but issue is that they only provide futures segment data and no cash market data. So i cannot trade using same plugin in cash market. so i am trying to make my own plugin. So please help me if you can.

    1. Hi Suyog,

      I can be part of your project, but i dont have programming knowledge, how can i include in it.

  8. Hi Rajendran,
    Firstly, Thanks for educating us. I have tried creating the sample project as mentioned above. but amibroker is not recognizing the function SimplePluginFunc1(Close, 5); Please let me know what could be the issue here.
    Thanks.

  9. how to License my DLL files and sell it to customers with Hardware Protection Lock or with expiry dates and licensed me .Net dll plugin by commercial protection tools like IntelliLock, CliSecure Licensing, .NET Licensing Pro, etc

  10. how to License my DLL files and sell it to customers with Hardware Protection Lock or with expiry dates and licensed me .Net dll plugin by commercial protection tools like IntelliLock, CliSecure Licensing, .NET Licensing Pro, etc

  11. Hi,
    I have downloaded visual basic from the link in the article – but amibroker plugin in not available. How do get it, please advise. Also I downloaded visual studio first then dot net. Hope that is not the prob. Would appreciate your reply – m trying to convert my afl code to dll.

  12. Hi

    I have installed .net for amibroker and it worked
    Also i installed Visual studio 2017 community edition but when i click on new project “Amibroker ” is not shown

    Please guide what can be the issue.

    Thanks in advance.

  13. I have a small community, and I want to share my studies with Ambroker. Anyone can help me make the key encrypt with the plugin afl.

    How much do I have to pay as a thank you?

    Please help me and Thank you very much

  14. 3)On the Left Side Pane Goto Tempaltes -> Visual C# -> Amibroker and select Amibroker Plugin template on the right side pane.
    In my PC there is no template, But visual C# is there , But inside that no Amibroker Option. Please give me a solution

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More