Integrating Amibroker with Python COM Server

Why Python?
To Create Complex Trading Systems we need to have a complex mathematical models and designing a highly complex mathematical models in amibroker is not so easy. However we can still build complex mathematical models with the help of Python. Python is a open source language similar to C,C++ and it has tons of open source their party modules for financial computings and implementing statistical models. Some of the third party modules use to build complex stuff are numPy,sciPy,pandas. You can google more to know about these statistical packages.

So if we are able to Integrate Amibroker with Python then probably it is like creating a gateway towards accessing complex mathematical models in Amibroker

What is Python COM Server?

COM (Component Object model) is used to enable interprocess communication and dynamic object creation in a large range of programming languages. Using Python COM we can create a interface between Amibroker and Python where Amibroker passes the variable and the complex computation is done with the help of python programming. The Python COM Server communicates with the Amibroker OLE object for interprocess communication as shown below.

If you would like to know more about python COM server then access this python COM server tutorial for better explanation

Python Com Server

Installing Python
1)Download Python 2.7 Version for Windows and Install Python2.7
2)Set the Environmental Variable,Now Goto Start->My Computer ->Right Click and Select Properties->Advance Settings ->Goto Advance Tab and in System Variable enter the Variable Name : PYTHONPATH and variable value C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;
Python Environmental Settings

Intetrating Amibroker with Python COM Sever

Here Iam going to demonstate the AFL code by Bruce Peterson on Integrating Amibroker with Python using IIR Filter example. IIR stands for Infinite impulse response (IIR) is a property applying to many linear time-invariant systems most commonly used in digital and electronic filters.

Steps to Follow

1)Download Python-AFL Set and Unzip it
2)Copy the file iir.py to \\python2.7\\bin\\ folder. And execute the file with the command python iir.py as shown below
Python Com File Execution
3)Copy the Python AFL.afl file and paste the file in \\Amibroker\\Formulas\\Basic Charts Folder
4)Open a New Blank Chart and apply Python AFL.afl to it. You should be able to see IIR(Infinite Impulse Response) and DEMA lines over the Candlesticks where the IIR is computed with the help of Python COM as shown below

Nifty IIR2

Related Readings and Observations

Comments

  1. omprakash says

    Hi rajendran sir .I am u r big fan. Watching u r live chart for 1 year learnt lot from it. your free live site is not working today 10-04-2014.kindly resolve them sir…

Leave a Reply

Your email address will not be published. Required fields are marked *