# What kind of basic framework or application do you use to run your trading algorithms?

I heard about MetaTrader from http://www.metaquotes.net. Is there any other framework or program available? Do you use different software for backtracking and running your trading algorithms?

Thank you guys for your great answers. I will check out the posted applications.

-
Please correct the grammar and spelling. – Shane Feb 1 '11 at 15:15
Thank you for the grammar and spelling update. English is not my mother tongue. I will try harder next time. – Sebo Feb 1 '11 at 22:15

I am a big believer in do-it-yourself (DIY) backtesting and data analysis, that is, obtaining your own data and writing your own code. I use my own simple Python scripts to process, test, analyze, and backtest, starting with text-input data files (either OHLC bars or tick data). The reason for DIY: in order to have an effective backtest, analysis, etc., you must completely understand all the assumptions, explicit and implicit, that go into the test or analysis. You must understand how that relates to the trading algorithm you implement.

As a quick example, people commonly say you must take off a tick or two in backtest results to account for slippage. However, I have found that for several of my backtest methods, I can actually count on getting better entries, on average, than the backtest. Whatever the case, I can sleep at night without worrying about someone changing something in the way the software works, which would throw off my tests without me knowing about it.

For algorithm execution, I also use a DIY Java API and Java applications build on the TWS API. However, the reason for that is just to save a few bucks.

Edit: Not sure I got this point across, but there is an intimate connection between back-test code, historical data, execution code, and real-time data. The relationship is different depending on what you are doing and what you are using, but it always important to understand the relationship.

-
Thanks Pete, I'm actually also interesting in doing it myself later on. What kind of database system are you using? Maybe there is a even a specialized version of a standard dbs available. – Sebo Feb 2 '11 at 17:12
PostGreSQL. Not sure why I use it over MySQL. Both are freely available. – Pete Feb 2 '11 at 19:14
@Pete What kind of visualization do you use, to better understand what your script is doing? Do you generate a R script end render it afterwards with R? – Sebo Feb 3 '11 at 15:05
I use Matplotlib (matplotlib.sourceforge.net), a Python library, for most visualization. The exception is when using JMP for data analysis, it has its own plots. JMP is a commercial product that I happen to have a license for through my company, and use it for convenience. There are plenty of numpy/scipy/etc. packages available for Python to do the same stuff. In fact I code stuff up in Python once it becomes part of a process. – Pete Feb 3 '11 at 16:51
Hi Pete. What do you exactly mean by "...,I can actually count on getting better entries, on average, than the backtest.". I would also expect to take off some slippage ticks. In which case can you avoid that? – user256 Feb 8 '11 at 14:42

Some of us see this as a data-driven, empirical problem. And for Programming with Data, you could do a lot worse than picking R which was made for the task.

The CRAN Task View on Finance lists a number of relevant packages. For trading strategies in particular, the quantstrat and blotter packages --which are both still on R-Forge in the TradeAnalytics bundle--are a very good start and are often discussed on the R-SIG-Finance mailing list.

-
+1 For R; definitely the way to go. :) – Shane Feb 1 '11 at 15:16

I develop strategies for a lot of these different platforms and the one that I feel offers the most is NinjaTrader. It uses C# which is a bit slower than MetaTrader, which if I remember correctly uses a variant of C++, in fact in MT5 there should be almost no difference. However, it makes up for the slowness in spades with the freedom it allows you. Not only that, but I've had the least problems with it, contrast that with MetaTrader, which I absolutely dread coding in because everything feels like a hack and the historical backtester is just terrible. And if memory serves they don't have near the charting capabilities and they only offer a few periods with which to view the data.

One thing to note, NinjaTrader isn't free like MetaTrader. (You can't trade live without paying for it, however everything else is free) It's \$1000/lifetime or \$180/quarter, and they don't offer refunds so be sure you find a brokerage with a free trial before you go paying for it.

If you're looking for a free alternative, I have played a little with OpenECry, and they seem to do a lot of things right that NinjaTrader does wrong, but it doesn't offer near the freedom that Ninja does either. So it's really a trade off and I feel Ninja wins.

-
Cool, I will check out Ninjatrader – Neil McGuigan Feb 2 '11 at 3:20

Like @Pete mentioned; knowing what assumptions you are making in your testing and what impact those assumptions could have on your algorithm's results are one of the major drivers to rolling your own trading simulation engine.

The framework listed below is based on daily bar needs. Your mileage may vary if you're focused on intra-day.

• Good data. If your trading rules are mid to long-term in nature; you'll need a data provider that has a) true dividend-adjusted data (know of only 2 at this time: CSI Data & FastTrack) and b) delisted data. CSI is the data provider I currently use. Know of others that offer true dividend-adjusted data? Please comment.

• Language choice. I've prototyped the simulation engine in various languages over the years. R Language was a true winner for awhile until my data needs grew too large. But, if you don't have big data needs...R is really hard to beat for time series analysis. Like @Dirk mentioned; check out the R-SIG-Finance listserv (many gems in there). In the end, I went with Python. Though, the speed can be an issue at times.

• Database. I've also used quite a few database backends for the simulation engine. Could spend pages and pages on what to do here. But, if you don't have big data needs - just go with simple CSV files and use the file system as your index structure. Or if you must have a SQL hammer...give SQLite a shot. Due to big data needs, I had to roll my own here.

• I also use Python's matplotlib for charting. Really nice. But, currently reviewing other charting packages such as Protovis.

• Use DataTables for displaying the results of large simulations.

-
I used Protovis (outside finance) earlier this year. It works fine on Chrome browser for mid-sized data, but not so much on Firefox. May have perf issues with large data. Working with Javascript (in addition to one more language) is an additional overhead. – phaedrus Oct 25 '11 at 4:41

We use intensively MetaTrader but it has a lot of problems... we waste a lot of time with turnarounds and dirty tricks to make things work.

Now we're moving some developments to Matlab because it is stable and great for quick prototiping, also you can use free software like Octave, R, Maxima and Sagemath (wich I think englobes all these others applications).

-

Marketcetera. I haven't tried it yet, so I can't personally comment on its quality. But the website looks great, plus it's an open source. You can download it for free and make some modifications. The platform supports Java, Ruby, and Python.

-

I have found NinjaTrader to be a very powerful free platform, but as I needed to add support for options, I ended developing and backtesting strategies. I haven't gotten to the point of doing to automated trading yet, but I have read it is possible.
Brian

-

I have worked with First Futures at the time developing their Strategy Studio against our platform, has back testing and algo tuning possibilities: http://www.firstfuturessoftware.com/products/strategystudio.php

-