Don't Miss
Home » Articles » How to make proper equity simulations on a budget – Part 2 Software

How to make proper equity simulations on a budget – Part 2 Software

Your choice of simulation software can have a greater impact than you may think. Most simulation platforms that are priced within reach for hobby traders and even smaller asset managers are quite frankly junk. If you start modeling in those environments, you will most likely either need to throw it all out and start over later, or accept massive error factors.

Last month I wrote about how to make sure you get solid data to work with. As I expected, it turned out to be one of the least popular articles I’ve written. Probably because it lacked my usual rants and overly opinionated attacks on technical analysis, clueless bloggers or retail trading techniques. Don’t worry. I’ll get back to ranting soon again.

So let’s assume that you’ve actually read the article last week on data, and that you have gone and bought a solid set of data to work with. Now you need software solutions.

If you don’t have a really good reason for picking some other software, I would strongly recommend RightEdge. There are two reasons for this recommendation. First, this is my own personal environment of choice. I wrote an article a while back explaining why this software is both really great and extremely cheap. The second reason is that I get a kick back if you buy it. Yep, that’s right. But only if you give them my super secret coupon code, clenow. The good news is that if you use this code, you’ll get a 10% discount, so we both come out ahead.

The short story of why I like this platform is that it’s extremely flexible. It can do what you need to get done. This is exactly the problem with almost all other reasonably priced simulation platforms. They won’t let you do anything other than what the developer had in mind. They’re not really development environments, they’re just scripting boxes.

RightEdge is based on the CLR platform, so you can code everything in C#. You could also use VB.Net if you really want, buy what would be the point of that? You build not just the simulation code in C#, but you can also make any plugins you like. Something missing in the product? Fine, build it yourself! I make new plugins all the time for reporting, visualization, simulation, data handling etc. It’s really not that difficult.

If coding scares you, then you have two choices. Get out of the systematic trading field, or pick up a programming book. No, hiring someone won’t cut it. Learn it, or find another hobby. It’s not scary and it’s not difficult.

Adapting the Data

In the last article, I wrote about my suggestions for how to structure the data in a MySql server. Of course, neither RightEdge or any other software will read straight from your MySql tables. You’ll have to construct a data adapter.

The good news is that RightEdge ships with plenty of sample code. The easiest way to learn the API for a data retrieval adapter is to open a simple one, like the Yahoo Data Retrieval sample and modify it to read from your database instead. The image below shows you where to find the samples.

Learn from the samples

Learn from the samples

And how to you open the files? Well, you need to get Microsoft Visual Studio of course. Yes, you need a compiler.

Now make a new dll. Reference RightEdge.Common and MySql.Data. Implement the IService and IBarDataRetreival interfaces. Fill in the obvious blanks in the code. And finally, use the SQL query from the last article, or something similar, to go fetch the correct, adjusted data and feed it back to RightEdge. Easy.

Remember to return properly adjusted series. If you want to go a step deeper, you may want to put a toggle in the user interface for getting total return data or regular price data.

References and interfaces

References and interfaces

Fetching data

Fetching data

Making a data adapter is really easy and it makes for a good exercise if you haven’t done much coding before. No, I’m not going to give you the full source code. That wouldn’t really teach you anything. Trust me, I’ve given you enough information above. From that, it’s really easy to finish the adapter.

When it’s done, compile it and copy the dll into RightEdge’s plugin folder. If all is done correctly, it will be part of the platform when you next open it.

Setting up the Adapter

Go to the tools menu in RightEdge and select Configure Services. Click new. If you made the adapter correctly and put it in the right folder, you should now see it listed. Give it a nice friendly name and add it.

New service setup

New service setup

Watch that List

With me so far? Then let’s set up a watch list. Make a new watch list and open its settings. Go to the Service tab as shown below and tell your watch list to use your data adapter.

Watch List Settings

Watch List Settings

Now you can add all your symbols. If you want to do it manually, just copy/paste them in. If you want to do it more properly, take a look at the file SymbolConfig.xml in the RightEdge folder under your user profile. The way I do it is to make a little program that auto populates symbols with all the correct meta data, by writing straight to the SymbolConfig.xml.

Note that if you’re doing the kind of simulations I did for Stocks on the Move, you will need to add a lot of symbols. You would need all current and past members of an index, regardless of whether those stocks still exist or not.

Once you’ve got the symbols in there, you’re ready to rock. Click the update button, shown with a red arrow above, and data will load. You should see something like the image below. If you get errors or 0 bars, you’ve got yourself a problem.

Updating...

Updating…

Now you should be able to get chart data. Double click one of your stocks and see. If you get the data now, you’re ready to build your trading strategy.

Easy!

Easy!

 

You see? I told you it was easy.

 

8 comments

  1. Good artikel (again)

    The boring stuff is the most important.

  2. Thank you for your article. I just started to learn C# a couple weeks ago and you’ve given me some great advice to help me stick to it and set some goals. The trading software seems pretty expensive for the average hobby trader but you put forth a compelling argument to start saving for it. Thanks again.

  3. I’m glad to see you started writing articles again after being silent for sometime since publishing your second book. This is one of my favorite articles (both part 1 & 2). It is an article filled with goldmine, really appreciate for sharing details of your work and help your readers to grow.

  4. Hi Andreas,

    I listened to your podcast interview on Top Traders Unplugged. Very good. Currently I am in a coding Bootcamp here in the states, and learning how to build front end, back end, and full stack applications. I’m curious, in the systematic trading world, what programming languages are most popular to build not only trading systems, but entire proprietary testing and trading platforms for those systems. Currently I am fluent in JavaScript and node.js, C# and a few other web focused languages, but have little experience with java or anything else. Any thoughts on a good direction for study if I want to build my own fund from the ground up?

    Cheers!

    Matt

    • Hi Matt,

      Looks like we have very similar objectives. I’ve traded for a while, ran into a scary draw-down that wiped out all my profits for 12 months in 2 weeks, quickly realized that this was not the proper way to do it and started researching the field. After reading plenty of books stumbled upon FTT by Andreas. I wish it was the first book on trading I read, since it was a real paradigm shift. Having no programming experience I found myself helpless in trying to replicate what was in the book with RightEdge (I used TradeNavigator before, which is pretty much drag&drop system builder with proprietary scripting language). So I enrolled into the Software Guild .NET bootcamp and graduated from it last month. Aren’t you by chance also from the guild?)

  5. Andreas,

    I just read you book, “Stocks on the Move” and had my eyes opened to many of the mistakes I’ve been making for years as a retail, strategy testing, indicator-obsessed trader. Your section on risked-based position sizing and re-balancing was enormously helpful. Thank you for the sage insight into to real world of trading. A tip of the hat to you.

    Brian

Leave a Reply to Stan Cancel reply

Your email address will not be published. Required fields are marked *

*