Open source Auto Trading for IB TWS

Discussion in 'Automated Trading' started by james2hunt, Dec 18, 2012.

  1. Version 2.11_04 build now has a feature that allows you to back test one time frame and replay the bars on a lower time frame this gives a more realistic back test.

    So if you run the Get Broker Data against IB TWS you can write your strategy to say trade on 1hr bars and say retrieve 1 week of data for your indicators and then set a parm in the configuration to retrieve the current trading day 5min bars also. So when the strategy is tested. It will pull the 1 W hourly bars but for the intended trading day it will pull and replay the 5min bars building the hourly bars for that day.

    So the strategy will trigger every 5 min (as the current hourly bar is build and values change) and the new bar flag will be true every hour as that bar is completed.

    https://code.google.com/p/trade-manager/

    James
     
    #11     Apr 6, 2013
  2. I'm having a heck of a time getting MySQL configured and running correctly on XP (I'm a software guy but not a database guy). When the installer tries to start the service it gives an error. I suspect it's something basic.
     
    #12     Apr 12, 2013
  3. Usually its port 3306 is not free and on install that was the default. Most errors you can google to find a solution as MySQL install straight forward.
     
    #13     Apr 13, 2013
  4. I got it sorted. The MySQL install on XP wasn't working because the default credentials for starting the MySQL service don't work. I overrode the defaults with my normal login credentials and got it started.
     
    #14     Apr 13, 2013
  5. You should add ta-lib to trade manager. It will open up the number of indicators to use without writing them yourself. Plus give samples on how to do it.
     
    #15     May 16, 2013
  6. Nice set of libs could be linked in simply. Quite easy to do. So far I have just added them as requested.

    In my app you just need to define the parms in the CodeType/CodeValue table. Then a series and object for the series. The series contains the function to calc the values based on live input values (I use rolling 5sec bars i.e. if the cart is 5min bars a rolling bar contains 5*60/5 values).

    James
     
    #16     May 18, 2013
  7. mark_mm

    mark_mm

    Seems like you have put a lot of work into this. Not sure how Java is these days in comparison to C#/C++ performance wise?, probably negligible when you have multithreading and network.

    I am working on my own system using C#, MemoryMappedFile for tick/bar/contract data. SQL Server for trades history. Will be putting on a web UI so I can check it from anywhere.

    Good job though.
     
    #17     May 18, 2013
  8. OK I've updated the videos to show the latest version. First video shows the features the second one now just shows how to create a strategy.

    The schema has changed to allow the same position to be traded using multiple strategies. Back testing now uses 1min bars to replay your specific time-frame.

    See vids and get source code + a demo database at

    https://code.google.com/p/trade-manager/

    James
     
    #18     Jul 12, 2013
  9. OK I've tuned the 5 min gap bar strategy and tested against 9mths of gapping stocks. i.e. over 1200 possible positions

    Results are:
    Batting 51%
    Simple Sharpe ratio 1.76

    i.e. wins 51% of the time and makes 1.76 times what it looses. Not bad for a simple strategy

    Ran it using an account balance of 50K with 4X leverage total profits over 10 mths 35K on a risk unit of $200 per trade. i.e max loss per trade is 2 risk units.

    https://code.google.com/p/trade-manager/

    James
     
    #19     Oct 25, 2013
  10. Looks like a good app, downloaded it and setting it up at the moment.

    Your backtesting results sound a little too good to be entirely accurate unfortunately. Did you clean the data somehow and check it for bad ticks, count commissions etc.?
     
    #20     Oct 27, 2013