OpenQuant + AmiBroker: my recipe for building robust Automated Trading Systems

Discussion in 'Trading Software' started by dareminator, Apr 29, 2008.

  1. I find OpenQuant to be an excellent Automated Trading System (ATS) development and execution platform. Very clean, comprehensive, and well thought out class and event architecture. The online help file is somewhat weak; however there is a good Getting Started guide and lots of sample code to get you going. Reasonable support forum assistance.

    However, OpenQuant does not lend itself well to rapid interactive exploration and experimentation. For that I use Amibroker. I use Amibroker as my discovery tool, kind of like Excel, to test tens of ideas, and to run thousands of backtests (AmiBroker backtest is roughly 150 times faster than OpenQuant, and 1 to 2 orders of magnitude faster than any other tool I have tested). Good documentation, large user base, and fanatical customer loyalty (== good support forum assistance).

    After I create and refine a trading strategy with AmiBroker, I use OpenQuant as my development platform, for easily and rapidly developing and deploying robust unattended automated trading code.

    After many years of trying out almost every platform and tool out there, and writing my own custom Automated Trading Systems applications (first in C++, then C#), I settled on this combination. It works well for me. My copy of OpenQuant currently trades 11 automated & unattended (except for a morning restart) strategies in live mode with real money. So far I am generating a decent return (which makes me happy).

    I am posting this message as an extremely satisfied customer of both OpenQuant and Amibroker. I have no relationship with either company (other than having paid for their software). I hope this might save people who are building Automated Trading Systems some time in their search for software tools.
  2. a5519


    Your opinion is appreciated very much. It's useful !
  3. mangudai


    I just read on the Amibroker website that they have an automated trading interface. Is there any reason your not using that instead of OpenQuant?
  4. I do still use the AmiBroker auto trader interface for a weekly strategy, where I generate trade signals and submit orders for 10 symbols once per week. It saves me from typing 30 orders (10 entry + 20 bracket order prices).

    However, while I ran a 1-minute live system with AmiBroker for about a month last summer, I had to terminate it as I couldn't build a robust stateful (code that remembers what it did, what is next, etc) auto-trading system with the AmiBroker interface.

    Here were my issues:
    - The AmiBroker auto trader interface works in fire-and-forget mode. You don't receive events when an order executes, is rejected/cancelled, connection is dropped, etc. You need to periodically poll the interface for status.

    - You set your AmiBroker code to execute every n seconds. It runs from scratch each time it executes -- you need to rely on static variables to keep your state (entry price, target price, etc).

    - When I set the code to execute more than once every 15 seconds, the results from polling occasionally returned false information (it would return "null" for order status when an order was in fact still working).

    - When I wanted to trade more than one instrument (say both GBP and EUR futures), polling order info on both of them consecutively would always return erronous information on the second one polled.

    At the end I couldn't make even a single strategy-single instrument work reliably enough with the AmiBroker auto trader interface. Multiple strategies, multiple instruments, in 1-minute bars (which can't be considered fast for autotrading) was just not gonna happen.

    OpenQuant runs in an event driven way: a bar / quote / trade is received, which triggers my event handlers. An order is filled / partially filled / rejected / etc, which again triggers the event handlers. The logic becomes very simple to implement and a robust end-to-end system can be built.
  5. mangudai


    That was a very useful and comprehensive response. Thank you very much!
  6. Very interesting and useful, dareminator.

    I'm on a similar path right now, using Java for the ATS, AmiBroker for exploration, and R for statistics. Have to totally agree what you said about Amibroker. Tomasz is a class act, a gifted programmer who can balance technology and customer-focus. I wish they had a version of OpenQuant in Java! ActiveQuant is there, but being new, it's not as well-tested/time-tested as a commerical product would be.

    I'm half way through Aronson right now, and plan to read Katz ("Encyclopedia of trading strategies") next. Can you recommend any further reading to help establish a base from where I can explore mechanical trading further? Any words of advice would be highly appreciated! Clearly, you're a battle-scarred veteran here.
  7. Retief


    Did you consider using TWSLink with Amibroker? It seems to be more capable and is updated much more frequently than IB controller.
  8. No I did not try TWSLink. It looks interesting though, I might play with it some time.

    My true issue with using AmiBroker to drive automated trading has been the programming model: When my code can only be run from scratch every n seconds, the polling, the error handling, the logic for multiple instuments, and trying to cram multiple strategies into one file (with the help of #includes) is too much.

    Also, I am now working on developing a strategy that keeps positions for less than a minute -- and I would really like to respond to an event when it happens, not at the next polling interval.

    The event-driven programming model of OpenQuant allows me to simplify the autotrading code. I can keep the program logic and the possible execution paths in my mind when I read the code. For me that translates into robustness and lesser suprises.
  9. TigerBalm, thank you for the nice words.

    I found "Beyond Technical Analysis: How to Develop and Implement a Winning Trading System, 2nd Edition (Hardcover)
    by Tushar S. Chande (Author)" useful.

    With the power of AmiBroker I find myself exploring many different parameters and paths for a strategy, and have difficulty comparing them and selecting which particular variety(ies) to deploy with real money. Stuff I picked up from Chande's book was helpful in my determining how to go about doing that. It also has some useful rules of thumbs for estimating the future maximum drawdowns and operating limits of a strategy -- which is always good to keep in my mind.

    Another book you might find useful (I learned about it from the OpenQuant getting started guide) is "Trade Like a Hedge Fund: 20 Successful Uncorrelated Strategies & Techniques to Winning Profits by James Altucher". This might be a bit simplistic if you are already far along in your journey. I would have certainly enjoyed reading it 4-5 years ago rather than now. My wife recently decided to learn more about the markets and mechanical trading, and she found it helpful.

    Good trading.
  10. Dareminator....
    A couple of questions for you to consider. I too want to automate a system which uses 1 minute bars and the big issue for me is getting the price information that I gather to accurately match the what I see on the chart that Im trading off. What happens is that even a small difference in the timing of the trading ATS vs. the Trade server that the information is coming from is enough to totally mess up the tape because the minute difference changes the shape of the bars. SO the big issue for me is why the various trading platforms like IB which Im currently using dont allow you to synchronise your applications time clock with there trading systems time clock so that when the bar changes from one minute to the next the 2 are perfectly synchronised.

    This is a huge issue for me and as the TWS clock turns out to be based on your home computers clock instead of on GMT or universal time as it should be its driving me nuts with the various tiny conflicts it creates in various separate applications becaue they are all reading the time differently instead of in synchroicity.
    One solution Ive seen would be to spend the necessary amount of money for DOD level atomic clock synchronisation ...

    which would make my pc clock perfectly synched with the official atomic time and hopefully pull these disparate programs into line with each other. But seriously the time clock issue is totally overlooked by every system out there meaning you need third party products because you cant get things to work together in harmony like they should. Even the fix standard which should absolutely involve some kind of standardisation of the timing mechanism seems to totally ignore the obvious need for everything to be synched together so that if your system is reading a price bar it matches the trade servers interpretation of that price bar and so on and so forth. As I say its driving me bananas...
    #10     Apr 29, 2008