7
$\begingroup$

I'd like to start automating my trading strategies. I'm not looking for a fast and easy solution, therefore the programming language is not important for me, I am ready to spend an extra year to master the required technologies if needed. I'm very good with R, VBA and SQL, used Python a bit, but don't know any C++/C#/Java.

I'm looking for a recommendation on what framework and related programming language to learn. I can't afford any expensive solutions, a free open-source framework would be ideal. I trade futures and stocks with IB and my trading strategies mostly use a combination of simple technical rules. However, sometimes I really need to get some extra data to generate an entry or exit signal, e.g. check if today's date is present in some list of dates in the database, or generate a custom breadth indicator (like at the moment some condition is true for at least X% of stocks from certain list of stocks). I can fairly easily backtest such strategies in R with my own backtester, but I have no idea if ready frameworks for automated trading allow that. Having read some articles and forum posts I realized that I probably need CEP to program such rules. If so, then as far as I know I'm limited to AlgoTrader among free solutions. However, I've read opinions that AlgoTrader is extremely complicated to understand even with a solid background in Java, which I lack at the moment, and that it lacks proper documentation. Is there anyone, who uses AlgoTrader, in here? Are there any alternatives that allow to program algos similar to what I described above?

In theory I can send trading signals from R, but I'd like to get more reliability, speed (I don't need HFT, but recalculating custom breadth indicators for several systems takes time) and some ready framework that can be used to both backtest and trade using the same code to generate signals. In addition, there are probably other good reasons that I'm not aware of why hardly anyone uses R for automated trading.

Any recommendations?

$\endgroup$
8
  • $\begingroup$ are you looking just to automate the backtesting and trading signal generation, after which you will manually enter orders or the actual order generation direct to the market? $\endgroup$
    – chollida
    Commented May 9, 2014 at 18:34
  • $\begingroup$ I already backtest and generate signals in R, and trade them manually. I'd like to actually place orders. $\endgroup$ Commented May 9, 2014 at 19:48
  • 1
    $\begingroup$ The open source version of AlgoTrader is fairly limited but it looks like it has everything you need. Regarding documentation, there is one available here: (code.google.com/p/algo-trader/wiki/AlgoTraderDocumentation). The advantage is that you can use the same code for back testing and life trading $\endgroup$
    – Andy Flury
    Commented May 9, 2014 at 20:31
  • 2
    $\begingroup$ quantopian.com supports automated trading of python algos to IB. $\endgroup$ Commented May 9, 2014 at 20:53
  • 1
    $\begingroup$ Andy, thank you for your comment. I had a quick look through the documentation, I got used to seeing something longer than 16 A4 pages, this is what worries me. However, it might be enough. I can't assess it before I actually try to use it. Do you know any other free open-source projects with similar functionality? $\endgroup$ Commented May 9, 2014 at 22:30

5 Answers 5

6
$\begingroup$

To be honest you're not likely to get a very satisfying answer to your question. Not because its a bad question, but because "regular people" can't just go hooking their home grown trading systems up to a live market.

I'd like to start automating my trading strategies.

First off you'll need a system that can interface with your broker. If you're not a fund then you won't be able to certify your own fix engine for trading, which means you're path of least resistance is probably to interface with something like IB.

In that case your best bet is to read up on the Interactive Brokers api https://www.interactivebrokers.com/en/?f=%2Fen%2Fsoftware%2Fibapi.php%3Fib_entity%3Dllc

$\endgroup$
1
  • $\begingroup$ Thank you for your reply, chollida. Does this mean that you recommend to work with IB API directly from Java or C++ without using any frameworks that usually allow to easily switch brokers (not necessarily using FIX) and are meant to make algo-trading easier? The definite advantage here is nice documentation of IB API. However, I'm not sure if doing everything from scratch using nice docs is easier than using a framework with not so nice docs. Can you comment on how much code is pre-written in frameworks like AlgoTrader in comparison to using pure IB API? $\endgroup$ Commented May 9, 2014 at 22:51
3
$\begingroup$

There's some pretty basic frameworks for IB. One that's pretty simple to modify is http://sourceforge.net/projects/jsystemtrader/ . I haven't looked in a while but it uses only market orders. The development has gone on to a version that uses market depth.

There's also things like Ninja Trader but paid per month.

It's what I do and I just use java with IB. I have a feeling you're going to write so much code that the framework isn't going to be much work in the end.

Since you said R and Python I'll just add

http://cran.r-project.org/web/packages/IBrokers/index.html

and

https://code.google.com/p/ibpy/

I haven't used either and don't know how well they work. I'm pretty sure the R package can download historical data. One thing to remember with un-updated frameworks is the API can change a bit and no longer work without some tweaks.

$\endgroup$
3
$\begingroup$

What about frontend like MultiCharts or NinjaTrader? Or even a cheaper one like SierraChart or AmiBroker? There is also cTrader Automate (cAlgo) and ProTrader PTMC. All of these are specifically built for real time trading of derivatives, including hooking up to a broker like Interactive Brokers, Lmax, etc. And they have their own programming language with built-in backtesting capabilities. Since you mentioned stocks, MC lifetime license is likely the better investment long term. Sierra Chart is also very stable and has lots of integration already.

Retail Fx is currently dominated by Metatrader 4....but if the broker allows FIX or other api, you can still use MultiCharts or the other charting apps. The worst that can happen is that you have to switch brokers, but you should be able to reconnect the algo (which will run a similar trading platform) to the new broker. In the case of mt4/mt5, you just move your strategy (called Expert Advisor or EA) to the new broker's mt4/mt5 instance (or just copy the new broker's [server].SRV file to the existing mt4/5 and "open an account" add new [server] name and it should ping after a few seconds.
Yeah, just easier to do a new mt4 installation with new broker's setup file)

It's worth mentioning that metatrader 5 (five) may eventually overtake mt4, and it is setup to handle multiple asset classes (stocks, futures, forex, etc). Like mt4, it is free to the end user. Unfortunately, MQL5 is not backwards compatible with MQL4 and MT5 cannot import or run compiled mql4 strategies. You could actually rig mt4 to backtest stocks/futures if you have tick data available (or 1 min bars if tick data is unimportant); so basically making your platform investment minimal as mt4 is free. Also, mt4/mt5 is configured on the broker side. So the trader only has to open the platform and begin their analysis or trading. And it is incredibly easy to migrate from one broker to another. Of course, choosing a trustworthy broker is much more important, but that's a separate topic of discussion.

Many of the answers put forward so far seem to focus on the user spending a lot of time either building their own trading platform or having to spend a lot of time to connect a platform. Maintaining an independent trading platform is a complex, expensive endeavor. IMO there is no reason to reinvent the wheel ^^; spend that time developing and testing your algos in a deployable environment.

^^(not recommended)

But if you want to have a go at your own proprietary platform consider Modulus M4 platform + source code to get you going.

Updated 06 June 2018 to add urls and mention a few more platforms.

$\endgroup$
2
  • 1
    $\begingroup$ Informative answer, but can you please add links to those tools? $\endgroup$
    – not2qubit
    Commented Jun 4, 2018 at 7:01
  • 1
    $\begingroup$ @not2qubit Done. And I added a few more tools and elaborated on old ones a bit. Hope this helps. $\endgroup$
    – Jon Grah
    Commented Jun 6, 2018 at 4:47
2
$\begingroup$

There is also http://ibconnector.com/, which is free, afaik, and an alternative to IBrokers. I've worked with it before and for basic orders, it was very fast and reliable.

$\endgroup$
1
  • 1
    $\begingroup$ Those guys don't look serious (check the founder and his description of the project: ca.linkedin.com/pub/alon-honig/35/407/369). They say that they do some reports, transaction cost analysis etc., but I didn't find anything like that. All I found was a couple of functions that do the same thing that IBrokers package does. Looks like some failed amateur start-up. $\endgroup$ Commented May 27, 2014 at 13:00
1
$\begingroup$

Update Dec 2018. Basic auto-trading code for R and Interactive Brokers API can be found at https://github.com/PhilGuerra

I know the code works b/c it is the same code that I modified so that I could automate trading long/short futures portfolios.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.