Amibroker Automated Trading

Amibroker Automated Trading – Enhancing Algo Trade Live (Automate Strategy In Interactive Brokers)

This article looks at how to trade live and automated with Amibroker via Interactive Brokers. We have been using Amibroker for live automated trading for a few years, without any problems worth mentioning.

Automatic trading with Amibroker and Interactive Brokers is relatively easy. You need to address a few issues to make a robust code for sending and sorting your trades. For a fee, we offer a simple script that gets you started pretty fast with automatic trading at Interactive Brokers. Fortunately, trading your strategies live and automated with Amibroker is not as difficult as it sounds.

All backtesting and system development on this website is done with Amibroker. Despite its cheap price, we believe Amibroker is the best software for backtesting and charting.

However, Amibroker offers no ready solution for how to take your trading strategies into live mode, like for example, Tradestation does. In Tradestation you just check a box for “live mode” and you’re done. Amibroker is simply not built to connect to the almost unlimited brokers that exist (Tradestation is also a broker).

What is Amibroker?

Before you continue, you might want to read our review of Amibroker to get some background about the software. That article should give you a basic understanding of how to use Amibroker.

Does Amibroker offer live automated trading and algo trading? Is Amibroker fully automated?

Amibroker does offer the possibility to trade your backtests and strategies live. However, Amibroker is a standalone software and is not affiliated with any broker, similar to Tradestation which has its, own broker.

The good thing is that it’s not so difficult to take your backtests in Amibroker to the next level of algo trading.

To connect to a broker you need a plugin. This plugin is the “bridge” between Amibroker and the broker.

Why do you need a plugin?

You need a plugin for quotes and start communication with the broker. Amibroker needs to communicate with your broker to send orders and find out if you get a fill or not.

There are almost limitless brokers and Amibroker can’t make plugins for all of them for algo trading, but they have made a free plugin that lets you trade automatically with Interactive Brokers, probably the most used broker for active traders.

Even though Amibroker offers no plugin to all brokers, you can make your own plugin. That requires, of course, a great deal of programming knowledge and is out of reach for most traders.

If you are good at coding you might make your own customized plugin for your broker of choice that is just as good as anyone else’s. You can connect to any broker you like – as long as you know how to code.

But if you are not so good at coding, like most of us are, you might face some problems taking your strategies from the drawing board to a live environment – even if you have access to a plugin.

Amibroker Live Trading

Amibroker course for a live automated trading setup

If you need help in getting into live trading with Amibroker, we have made a course that gets into detail on how to do this. The setup and code are the same as we have been using for three years. Further below you get more details about the Amibroker course.

VPS and live trading

If you are serious about trading we recommend setting up a VPS – virtual private server. The cost is from 15 to 50 USD a month and you can keep all your data, programs, and systems in one place. We have done that for years and it’s handy when you are traveling, for example (you just log in via your laptop from wherever you are).

Amibroker and Interactive Brokers

Interactive Brokers is a very popular broker for traders – with good reason. They have a support that has a lot to be desired, but in terms of costs, markets, and execution they are (probably) the best. It’s a broker mainly for traders and less so for long-term investors.

Amibroker has made a plugin that lets Amibroker connect to Interactive Brokers. You don’t even need to install the plugin if you have installed Amibroker 5.7 or later (it’s already installed by the Amibroker setup).

Amibroker automated trading live:

To start live automated trading with Amibroker, you need to code a script that lets you manage your orders and trades to avoid multiple orders being sent (and filled). Below we have a few bullet points that need to be addressed when you make the code for automatic trading via Amibroker.

Obviously, the first thing you need is a backtested strategy with strict rules for buying and selling. When you are ready to try live trading with Amibroker, you need to include some extra code that needs to contain the following:

Here is how to automate your trading strategy for live trading in Amibroker.

  1. If you generate a buy or sell signal, Amibroker must connect to the broker via the plugin/bridge.
  2. After connecting to the broker, you must check if your strategy already has a position for this strategy. If you don’t do this step you’ll have multiple buys for the same strategy and you might end up penniless. The easiest method is to use a staticvariable for this.
  3. If you have a flat position or you want to add to the existing position, you want Amibroker to send an order.
  4. The brokers have different types of orders and thus the order type is dependent on the broker you use. You send the order of your choice (OPG, MOC, Limit order, Market order, etc.).
  5. Amibroker needs to keep track or store that an order is sent to avoid sending multiple orders (or at least to limit the number of orders).
  6. If an order is filled, then again Amibroker needs to keep track of the fill to avoid multiple fills for the same strategy.
  7. The same procedure must be repeated for a sell order.

In short, these are the main issues you face when you want to take your backtested trading strategies to live trading in Amibroker.

You can avoid some of the procedures above if you trade at a certain time of the day by manually scanning your trading strategies for buy and sell signals. It depends on the complexity of your trading operation.

Automate Strategy in Interactive Brokers- can you trade with Amibroker?

We have an Amibroker course that gets into all the details about how to automate strategy in Interactive Brokers. The broker of our choice is Interactive Brokers because of its product availability and low commissions. The course even has detailed code as an example to show how it can be done:

  1. If you generate a buy or short signal, you can adjust if you want to send an order based on a) if you already have a position in this trading strategy, or b) if you already have a max position in this specific ticker.
  2. If your settings indicate you should go ahead, you can set the order type that IB allows.
  3. When an order is sent, the script record it as you have a position. (If your order doesn’t get filled, you manually need to remove a saved variable to “free” your strategy.)
  4. When you later scan your buy or short signals, any signals will be rejected if you have already have a position.
  5. If you get a sell or cover signal, an order is generated to sell the order type of your choice and the script removes the variable that again lets you send the opposite signal later.

It’s a very simple script, but it should suit 95% of the automatic traders using Amibroker. We have been using the same script for years when we automate a strategy in interactive brokers without any problems. What we do is to turn on the script when we want to trade and make sure we are always not very far from the computer. With just a few lines of code, you are able to automate trading strategies in Interactive Brokers!

If you want to buy the code, please keep in mind that you need to check off our disclaimer. Mechanical trading always involves the risk of things going terribly wrong, and you should ALWAYS spend a lot of time paper trading your systems in a demo account before you go live. We make no guarantees about the code.

Additionally, you should never let your computer run without any supervision. Unknown factors and black swans happen all the time. Even though you believe you have covered all aspects of what can possibly go wrong, you can be sure something surprising pops up when you least expect it. Always be on your tiptoes!

If you understand and address the issues above, it doesn’t require much to do live automated trading in Amibroker and Interactive Brokers.


Does Amibroker support live automated trading?

Amibroker is a standalone software used for backtesting and charting in trading. Amibroker supports live automated trading. However, unlike some other platforms, it requires a plugin to connect to brokers. A plugin acts as a bridge between Amibroker and the broker, enabling communication for order execution.

Is there a course available for setting up live automated trading with Amibroker?

Yes, there is a course discussed in the content that provides detailed information on setting up live automated trading with Amibroker. The Amibroker Live Automated Trading Course is designed to guide traders through the process of transitioning from backtesting to live trading using Amibroker. Whether you are new to algorithmic trading or looking to enhance your existing skills, this course provides practical insights and hands-on knowledge.

How can traders automate strategies in Interactive Brokers using Amibroker?

The content mentions a simple script for automating strategies in Interactive Brokers via Amibroker. The mentioned script is a key component in automating trading strategies with Amibroker and Interactive Brokers. The script facilitates the connection between Amibroker and Interactive Brokers, enabling the transmission of orders and receiving order fills. The script incorporates conditions for generating buy or sell signals based on the trader’s strategy. It checks if there is an existing position for the specified strategy before generating an order to avoid duplicate orders. Traders can customize the order type based on Interactive Brokers’ supported order types (OPG, MOC, Limit order, Market order, etc.).

Similar Posts