Introduction to Real-Time Automated-Trading

Automated Trading of financial instruments is controversial and risky. Without exception, all code in this category is intended to demonstrate AFL programming techniques and not, under any circumstance, to place orders on your real-money trading account.

Code in this section has been developed using the latest versions of AmiBroker beta (4.96.0), the InteractiveBrokers Controller (1.1.1), and the TWS (873) as of this writing. If you experience execution problems, or AmiBroker gives you error messages, please verify that you are using the latest program versions before reporting bugs.

Unless stated otherwise, all programs are written to execute in an Indicator window. To run any of the examples, copy the code to the AFL editor and click Insert. To run programs that place orders on your paper trading or the eDemo account, the TWS must be open and connected to Interactive Brokers.

During initial testing, it is good practice to Insert the code in its own Pane under its own Chart-Tab, and activate only this window. This will prevent conflicts between static variables from different programs that may use the same name.

Most of the examples presented in this section are ready to copy, insert, and run. To give them this quality, peripheral code, like initializations, a trading system, and/or Title statement, had to be added. This makes the code a little longer but will give you a debugging start when applying the code and, at the same time, may expose you to some handy code snippets.

Edited by Al Venosa

Comments are closed.