Choosing a good platform for strategy modeling, simulations and signal generation is critical. The bleak reality is that most back testing software is horribly bad. They are geared towards consumers with limited knowledge and experience and they cater to what your average get-rich-quick technical analysis guru claims that you need. I’m often asked for my views on simulation platforms, and in this post I’ll show you my own perspective and choices.
Non-coders need not apply.
Forget about drag-and-drop system building. That’s not how you make real trading models. If you’re not prepared to learn simple programming to construct your strategies, so you can understand and control every detail, then you probably shouldn’t be doing this at all. You don’t have to be an expert programmer, but you do need to be able to write a bit of code. Let me say that again.
If you are not willing to learn about coding, you should give up all efforts to enter the field of systematic trading.
This is not rocket surgery. Learning enough programming is not that difficult, assuming that you’re of average intelligence or above and not afraid to crack open a book. There was a time when professionals thought themselves too good to learn how to type. Why would a lawyer type? He’s got a secretary. The Mad Men days are in the past and a lawyer who can’t type properly is now reduced to a big helpless baby. Learn how to code. Just do it.
What’s important in a simulation platform?
We all value slightly different things. This article is of course written very much from my own point of view. I value flexibility.
Most consumer level platforms draw a very narrow box around you. They won’t let you do anything outside of that box. They assume that you want to do a minor variant of some standard system and nothing else. They’re not for professional use.
A big problem with these consumer grade platforms is portfolio level logic. Most don’t have it. Some have it, but just as a horrible after-the-fact implementation they slapped on top of an old platform just to get Portfolio in as a marketing check box.
The development architecture and environment is very important as well. The more they simplify it to cater to lazy people, the worse the platform tends to get. I have a severe allergy against proprietary scripting languages and closed platforms.
Here’s what I want to see:
- Industry standard development language. Not “C-style environment” or some other way to say that you have a closed scripting syntax which vaguely resembles a real language. I want the real deal.
- My preferred language is C#. Not necessarily because it’s best, but because it’s certainly good enough and if you’re in an all Windows environment it’s a great language to standardize on.
- Extremely open architecture. I want to be able to do absolutely anything. Things that never even occurred to the people developing the platform. I want to be able to change or add any functionality I like. I hate being boxed into a corner when coding. Nobody puts Clenow in the corner.
- Infinite possibilities. Didn’t I just say that in the last point? Yes, but it’s worth saying again. I want to be able to make and plug in dll’s for anything. New visualizations, data adapters, broker adapters, database connectivity etc etc.
- Proper portfolio logic. This is rare in affordable platforms. The ability to back test trading models on thousands of instruments, as a real portfolio. This should be done the proper way, in the proper order. More on that later…
- Currency handling. Most platforms assume there’s only one currency in the world. The United States Dollar. If you trade instruments across multiple regions, this assumption breaks down fast.
WealthLab versus RightEdge
I’ve mentioned WealthLab and RightEdge in the past. They are both pretty good, but my preference clearly lay with RightEdge. I like them because they are both based on CLR, which means that you write proper C# code. They can can both be extended and modified by plugging in your own DLLs. They can both do portfolio level simulations, though they differ in the implementations. Despite the apparent similarities, they are very different to work with.
WealthLab is user friendly. Chart manipulations is easy. Making a first simple system doesn’t take much time. It feels like a comfortable environment. The documentation is good and there are plenty of samples you can work from. If you make mistakes, you tend to get quite polite error reporting, making it easy for novice coders to debug.
RightEdge looks like a compiler when you open it. That’s because it basically is a compiler. If you’re not used to a compiler, this can feel like you’ve just been parachuted into the jungle. There is definitely a steeper learning curve to get started with RightEdge.
Before you can really do anything, you need to get your data into the application. Both platforms of course come with some default adapters to get data from various free sources. For professional use, you’re likely going to want to get data from some custom source though. After all, you can’t rely on Yahoo data and such for real life use.
The good news is that it’s quite easy to build data adapters for both platforms. No real difference there. There are samples available that you can modify. Essentially, you make your own DLL in Visual Studio that implements their interface. There will be an interface similar to (pseudo code): Public DataSeries GetTheData(Symbol, StartDate, EndDate) and you just put your own code that to scurry off and fetch from your database or whatever source you prefer. Easy.
A key difference however is what happens to the data after your DLL provides it. WealthLab will ask your DLL for a fresh data delivery every time the application needs it. Every time you open a chart or run a simulation, your DLL will be bothered.
RightEdge on the other hand has it’s own optimized data storage. When your DLL returns the data, RightEdge will put it in that data storage. When a chart is requested or a sim is performed, RightEdge will get the data from there. Faster, more efficient, but could lead to data duplication and maintenance issues.
My solution is to flush the data storage daily and replace with fresh data from my primary source (my in-house MySql). That avoids issues of data duplication and discrepancies. I do this with simple scripting, using a good old bat file.
Here we start hitting the first weakness of WealthLab. The architecture of WealthLab is clearly not built for portfolio testing. It’s very obvious that this was an after thought. WealthLab processes one instrument at a time, going over each day for that instrument before moving to the next instrument. This is not how the real world works. It has the unfortunate implication that the trading logic itself is totally unaware of anything happening to other instruments. It doesn’t know the current portfolio holdings or even portfolio value. How could it, since all instruments are not processed yet.
WealthLab iterates bars in a for/next loop. This will likely shock programmers. Here’s how the process works for WealthLab:
protected override void Execute()
for(int bar = 1; bar < Bars.Count; bar++)
//process each bar
Yes, this does seem quite primitive…
RightEdge on the other hand has a correct and modern implementation. It’s event driven, processing each bar as it comes in. This works the same way whether you use static daily data or dynamic intraday streaming real time. The RightEdge way looks more logical. NewBar is called each time a new bar comes in, whatever the frequency might be.
public override void NewBar()
This also means that WealthLab has a dangerous potential for data snooping. When you’re in that loop, you have access to all data. You could just read the whole series. If the variable bar in the for/next loop above is 5, you could still check out what bar 6, 7 or 500 holds. You can read the future. You can also trade the future in WealthLab. Or the past.
RightEdge is not aware of any data that you would not be aware of in reality. When NewBar comes in on June 10, 2011, you have no way of accessing the data as of June 11. You also cannot trade on past prices or on future prices. You can trade now, or you can set limit/stop orders. Like in real life. This avoids the all too common mistakes of trade on information that was not available in reality.
All position sizing algos shipped with simulation platforms are bad. Don’t use them. Building your own is not that difficult. Well, it is in WealthLab.
Let’s say you want to do some simple portfolio level sizing algo. Take the classic ATR sizing, Turtle style. Easy math. You just take the current ATR as a proxy for vola and size your position to have a certain portfolio level risk. There’s only one problem. For this simple calculation, you need to know the portfolio value. Now, obviously, the way that WealthLab iterates one instrument at a time, your code won’t have access to that information. At the time when your code makes a trade, it hasn’t processed other instruments and therefore the portfolio value is unknown.
WealthLab first iterates all instruments as shown above, registers when we’re supposed to buy and sell, and first when it’s done with all of it, it goes back to figure out how many shares/contracts to buy or sell. Ugly.
In WealthLab you have to make your own position sizing DLL. Yes, you are unable to properly change position sizes in the application and you have to program your own DLL in Visual Studio just to set position size. Quite a mess, isn’t it. I made a volatility adjusted position sizer a while ago and published with full source code here: http://tradersplace.net/store/volatility-based-position-sizer-for-wealthlab/
So what about RightEdge? The same thing that needs to be done in a complex plugin DLL for WealthLab can be done in a single line of code for RightEdge. No need for ugly workarounds, since RightEdge implemented the data engine right from the start.
long numberOfContracts = (long)(Math.Max(1,SystemData.AccountValue * _riskFactor /
(_atr.Current * _point_value *
SystemData.AccountInfo.GetConversionRate(Symbol.CurrencyType,SystemData.AccountCurrency, QuoteType.Last) )));
If you want to do serious simulation work, you need to account for currencies. And I don’t mean trading currencies, I mean currency attribution. If you deal in international equities, you’ll have a currency exposure on open positions in foreign markets. For futures it’s less of course. There you only have FX exposure on your open P%L. Still, you need to deal with this problem.
RightEdge does it realistically again. You mark each instrument with the base currency, provide time series for currency translations, set your account base currency and your simulations will be done properly. Sure, the documentation for how to do this is lacking a bit, but it still works fine. Yes, if you bug me enough I’ll write a tutorial for how to use this feature.
As far as WealthLab is concerned however, there’s only one currency. There is simply no way to solve this problem for WealthLab. All your instruments need to be in the same currency, or you’ll end up with a huge but invisible error.
Price and sales policy
WealthLab costs $800 upfront and has a yearly maintenance fee of $150. Compared with many competitors, the pricing is quite far. The only problem is that if you live in North America, you’re only allowed to buy this product if you have an account with Fidelity. That’s quite a severe limitation.
RightEdge is unaffiliated with banks or brokers, and has no yearly fee. It costs only $500 once off. Actually, you’ll get a $50 discount on that if you use coupon code Tradersplace or tell them the magical phrase Clenow Sent Me.
WealthLab is not a bad system for quick-and-dirty modeling. It’s very easy to get something done fast and just try out how it looks. It’s not in my view a good system for heavy duty, real world stuff though.
I’ve tried implementing highly complex models on both platforms, and it’s very clear that WealthLab is struggling both in terms of functionality and performance.
Here’s an example of a strategy that I run daily on RightEdge:
- Equity momentum stock picking model.
- Considers over 4’000 stocks across all developed nations, including delisted stocks.
- Checks for which stocks are part of a given index constituents list on any time and only trades those.
- Ranks all stocks that were in the index on a given trading day on a complex set of criteria.
- Implements strata logic, keeping track of which stratum a stock is part of, based on the ranking.
- Sets portfolio limits in terms of strata, geographic allocation, sector allocation etc.
- Automatically constructs a realistic portfolio of the very best stocks, within the allocation constraints set.
- Constant rebalancing of risk and adherence to allocation constraints.
Doing this in RightEdge took some time and coding, but there were no technical issues. In WealthLab, I ran into a wall quite fast. Several walls. In the end, just to get a second platform going, I had to put much of the logic inside a database server, as WealthLab just couldn’t handle something like this.
Do I get paid for peddling these platforms?
No. At least not yet.
I contacted both companies to see if I could make a deal with them. I was recommending them anyhow, so why not. My suggestion was that they offer a discount to people I refer to them and that they give me a little something in return. Daniel at RightEdge quickly agreed and offered a $50 discount for users who enter my coupon code ‘tradersplace‘ when ordering. I get the same amount myself. So far, no one actually used that coupon code. I know that people bought after I recommended them, but so far they all forgot to enter that code… Oh well.
And WealthLab? Well.. they are a bit larger organization and that can be seen in their responses to such requests. It took a couple of months for them to get back to me, and then they came with a counter suggestion. They proposed that I change my business model. They suggested that I become a full time online seminar provider, doing training sessions on how to use their software. Hm.. Well, it’s good to know that I have options in case I blow up my hedge funds.
If you want to be a part of the systematic trading field, get things done right. Don’t make half assed solutions. WealthLab is a good gateway drug to get started with, but RightEdge is the good stuff. Having two platforms is not a bad idea if you have the time and patience for it, but if you go with one my suggestion is RightEdge.
Creativity is important in this field. Coming up with a hair brained idea and testing it out. Sometimes an oddball out of the box idea might actually lead to a huge breakthrough. If you’re stuck with a simulation platform that doesn’t allow you to be fully creative, you have a problem. Then you’re stuck implementing stone age technical analysis models.