GithubHelp home page GithubHelp logo

futures's Introduction

Futures Backtester

Modular algorithmic trading backtester using historical tick level data replayed through various strategies.

Futures Backtester is a tool to help quickly asses the viability of any trading strategy working off of Range bars, a price action candlestick formation. More information on Range Bars can be found here: Investopedia

Tick level data were downloaded using Rithmic as the data provider through a third-party trading platform, NinjaTrader. Historical tick data up to around September of 2013 for Gold futures (GC), Crude Oil futures (CL), and 30-year Treasury Bonds futures (ZB) are currently stored in a MySQL database.

![fad] (figures/gui.png) ![fad] (figures/playback_chart.png)

MySQL Data Storage

update_database_TICK.py - script to parse and place tick data for GC, CL, and ZB onto a mySQL database update_database_TICK_norepeats.py - script to compress data set for repeated tick values

Futures Algorithmic Development GUI

The Python GUI allows users to interactively set backtesting parameters such as instrument, range bar size, date range to test, and strategies to test through a crude editor. Each strategy should have a fixed Profit Target and fixed Stop Loss. Multiple strategies can be run at the same time, but must be specified through the editor. New strategies and/or indicators may be included with the backtester by adding additional classes to the strategy.py and indicator.py files. After each backtest, trade data will be written into a dropbox folder for further analysis in a similar format to the Ninjatrader trade data.

Setting up Strategies and Indicators

File can be modified through setup_backtest.py or through the GUI.

Multiple strategies can be tested at the same time to save time and allow one-to-one comparisons of the trade data. Care should be taken when specifying multiple strategies working off the same indicators with the same parameters. For example if N strategies are to be tested with various parameters such as ranging profit targets but work off the same indicator with a lookback period of 15 bars, all the strategies should reference the same indicator instead of declaring the same indicator N times. Example:

indicators = {}
indicators['FT'] = FisherTransform(bt, bt.range_bar.Close, 15)
indicators['FTD'] = Diff(bt, indicators['FT'].val, 2)

for PL in range(17, 25):
    bt.strategies['FT_Quicky_Base_PL' + str(PL)] = FT_Quicky_Base(backtest=bt,
                                                                  indicators=indicators,
                                                                  PL=PL,
                                                                  offset=3,
                                                                  FTdthresh=0.1,
                                                                  FTthresh=2.5,
                                                                  maxBars=1)

Usage

  1. python fad.py
  2. Select Range Bar size
  3. Select Instrument (GC/CL/ZB)
  4. Select Date range
  5. Click Run

futures's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.