Post
Topic
Board Speculation
Re: Goomboo's Journal
by
pulsecat
on 15/07/2013, 07:36:55 UTC
Those who are interesting in testing their strategies on history data, may also try my Backtesting tool.

For example, to backtest Goomboo's strategy over historical Mtgox data since March, first you need to post the code that might look as:

Code:
###
  EMA CROSSOVER TRADING ALGORITHM
  The script engine is based on CoffeeScript (http://coffeescript.org)
  Any trading algorithm needs to implement two methods:
    init(context) and handle(context,data)
###        

# Initialization method called before a simulation starts.
# Context object holds script data and will be passed to 'handle' method.
init: (context)->
    context.pair = 'btc_usd'
    context.buy_treshold = 0.25
    context.sell_treshold = 0.25

# This method is called for each tick
handle: (context, data)->
    # data object provides access to the current candle (ex. data['btc_usd'].close)
    instrument = data[context.pair]
    short = instrument.ema(10) # calculate EMA value using ta-lib function
    long = instrument.ema(21)      
    diff = 100 * (short - long) / ((short + long) / 2)
    # Uncomment next line for some debugging
    #debug 'EMA difference: '+diff.toFixed(3)+' price: '+instrument.price.toFixed(2)+' at '+new Date(data.at)
    if diff > context.buy_treshold          
        buy instrument # Spend all amount of cash for BTC
    else
        if diff < -context.sell_treshold
            sell instrument # Sell BTC position

After, select a date range and trading frequency using the form located above the chart.
Then click 'Run' and watch the log.
Backtest results
http://cryptotrader.org/backtests/6mqAkbNGvqDSC8Dz8

The API documentation is located under "Help" tab. At this time, only limited set of indicators is supported (EMA, VWAP), but i'm working on integrating Ta-lib library (http://www.ta-lib.org/) which includes 125+ indicators for technical analysis.