Open-source back-testing engines in C++

Discussion in 'Automated Trading' started by garchbrooks, Apr 25, 2010.

  1. Do any of these exist? I am exceeding the limits of my retail platform and need to optimize with better ability to subject optimizations; hesitant to start from scratch.

    I know about TradeLink, but am not interested in something written in C#.
  2. thstart


    what limits do you exceed? what features are you looking for?
  3. There's no simple, easy way to optimize subject-to constraints that make sense, kind of like all those lagrange multiplier optimization problems you see in statistics all over the place. It isn't enough to have portfolio level testing, because some of these programs don't fully allow you to enforce constraints that make sense.

    If you have 4 choices in A for parameter 1, 2 choices for parameter 2, and then a similar situation in B, but know that certain combinations require B to be the same as in A, a lot of the retail optimizers will waste time computing illegitimate test results. In some cases, the number of combinations far, far exceeds what needs to be tested and I end up allocating 30-60 hours of compute time for garbage when it should only take 10-15 hours total.
  4. byteme


    Perhaps I'm missing the point but if there is a such relationship between A and B, can't you make B a function of A?
  5. Don't blame you for missing the point; it's hard to explain.


    1) if the backtester only optimizes A without paying attention to B, or
    2) the backtester has no way to reduce the parameter space when testing A and B simultaneously

    it doesn't help.

    B should be seen as a separate strategy, for all intents of purposes, when it comes to these portfolio level testing tools. _Even when_ it's a function of A.
  6. Well, the problem can be better explained by saying that instead of optimization those programs do all available permutations of values and then sort the results. It is brute force optimization, a waste of time essentially.

    I have found the best algorithm for non-linear optimization that always converges to globally optimum values even if the initial starting vector is not a feasible solution.
  7. byteme


    I see.

    I suppose an alternative would be to find some software that lets you compute all of the valid parameter combinations beforehand and then run the simulations.

    A little off-topic but perhaps genetic search algorithms might reduce your waiting times too.
  8. Yes, but where does such software exist? I'm sitting here writing a backtester from scratch to solve a narrow problem, but hopefully I will get re-use out of the objects I wrote/am writing.

    They [genetic algos] do help but they don't subject the simulations to the right constraints either.
  9. LeeD


    often you can use some parameter transformation to make sure the optimisert passes aren't wasted. for example, if a>=0, b>=0, a+b<=1 you can define, 0<=x<=1, 0<=y<=1, a=x, b = (1-x)*y.

    You can apply the same logic in more complex non-linear cases.

    The point is:
    1) If you can simplify the problem like described above, then you should do so and use an existing platform;
    2) If you cannot, then it's a complex problem and you demand a very specific complex featuire, which is far beyond the field of backtesting and trading. If you have an optimiser with API which does the kind of optimisation you require, you can hook it up to many backtesting platforms.
  10. Henrik


    Yes one way is to built in a "parameter-checker" at the top of the code.

    And if your platform supports multicore (Ninjatrader 7, MultiCharts, ...) than use amazon cpu-servers
    (rent amazon High-CPU Instances, High-CPU Extra Large (XL) Instance ~ 20-25 GHz, 7 GB RAM, cost 1.16 $ per hour with windows or lower with spot instances).
    #10     May 2, 2010