Proper FX Backtesting

Discussion in 'Automated Trading' started by hilojack, Apr 4, 2012.

  1. Wasn't sure which forum to post this in as it applies to *many* but figured I would give it a go here. Have read many posts looking for my exact answer to no avail, so here it goes.

    Backstory: Developed an FX algo that was trading on ninjatrader with a reasonable amount of success. Went live when there only option to trade was thru was Gain capital and the re-quoting that went on screwed up my results as I wasn't being executed in the trades that the system thought it was. Decided I couldn't go live on ninja and looked for a different platform. checked multicharts, meta trader, etc and decided that all of them had some short comings so decided to go platform agnostic.

    Had programs black-boxed and now run on my server via FIX api to my forex FCM. Have been modelling the algo for a hedge fund and it has performed over the last 6 months very well and did what it is supposed to do.

    Now they want to see back-tested results, as well as out of sample, random walk etc. Obtained 2 years worth of back tick data for close to 20 different forex pairs and had the data cleaned the best that it could be. there are still some significant gaps, but those are manageable.

    The question is HOW do I backtest the algo without a platform and what metrics are used to review that performance? Right now we are strictly going off of P&L and drawdown.

    This seems like such a basic question yet I was afraid to ask the investor for fear of showing my lack of knowledge. Is there a platform for just bactesting or a template I can follow to achieve what I am looking for? My programmer likes to write everything from scratch but I am afraid that A) this may take too long and B) a mistake is bound to happen one of these days and I would hate for it to be this!

    I don't mind paying for something that is comprehensive and secure, though free is always better if given the choice.

    So I'm basically looking for something that I can upload my data to, do the backtest, and then have the various metrics spit back. Sharpe, sortino, max DD, etc. In fact, I'm not even sure all of what would be needed in the eyes on an investor. I suppose in this instance more is better, but I want to know what the "must haves" are to make sure I do not miss something important.

    If you have experience in this area, please help!

    Thx.
     
  2. you may want to look at tradelink.

    it's free and open source.

    tradelink has portfolio realistic super fast tick-based backtesting.

    works with equities/options/futures/fx across many brokers.

    been around since 2008, hundreds of developers and thousands of users. many statistics are supported, including sharpe/sortino/maxdd/etc.

    you can build strategies in any .net language and run then in the off-the-shelf tools, yet still retain ability to see source and modify if need be.

    google tradelink project or tradelink.org for more info.
     

  3. Hi tradelink guy-

    I have come across your software, but I don't need to build anything in .net. My code is written in C++. Is there a way to still use tradelink?

    Does it have a sample report I could view to see what the results would look like?

    Thanks.
     
  4. yes, c++ is a supported .net language.

    you can also expose your calls as a dll interface and just call it that way from a .net wrapper.

    here is example summary results from running smaresponse example on example single symbol of wag tickdata

    Stat Result
    ResultsId
    Symbols WAG,
    GrossPL -102.00
    BuyPL 5.00
    SellPL -107.00
    Winners 6
    BuyWins 5
    SellWins 1
    SellLosers 5
    BuyLosers 3
    Losers 8
    Flats 0
    AvgPerTrade -3.52
    AvgWin 8.67
    AvgLoser -19.25
    MoneyInUse 4,803.00
    MaxPL -36.00
    MinPL -111.00
    MaxDD -2.31 %
    MaxWin 18.00
    MaxLoss -60.00
    MaxOpenWin 0.00
    MaxOpenLoss 0.00
    SharesTraded 2900
    RoundTurns 14
    RoundWinners 6
    RoundLosers 8
    Trades 29
    SymbolCount 1
    DaysTraded 1
    GrossPerDay -102.00
    GrossPerSymbol -102.00
    SharpeRatio -7.97
    SortinoRatio -7.97
    ComPerShare 0.01
    ConsecWin 4
    ConsecLose 5
    RiskFreeRet 1.00 %
    CheckLiveAfterTickCount 1
    CheckLiveMaxDelaySec 60
    isLive False
    NetPL -131.00
    HundredLots 29
    WinSeqProbEffHyp 100.00 %
    LoseSeqProbEffHyp 78.13 %
    Commissions 29.00
    WLRatio 0.00
    GrossMargin 1.28
    WAG 29 for ($102.00)


    look at the strategy development quickstarts (try tradelink) for running your own examples.
     
  5. OK great. I will have my guy take a closer look at it.

    And as far as the reports go, that's quite a list.

    Can someone else chime in if there are any other metrics I might need based on my original response?

    Ulcer Index? Z score? Or any other metric tradelink does not have?

    Thanks again!
     
  6. generally sharpe/maxDD/return/avgret and correlation to benchmark are the major ones.
     
  7. Multicharts works good and reliably for me.