Trading robot DSL version 0.0.2 released

del.icio.us Reddit Slashdot Digg Facebook Technorati Google StumbleUpon Yahoo Bloglines Bookmark.it Ask Mister Wong Netvouz

Changes:

  1. Plugins support for flexibility
  2. IB Trader workstation online and history mode for quotes
  3. IB Trader workstation market and limit order placement
  4. SMA and EMA functions

List of plugins:

  • IBHistoryPlugin - for history quotes IB TWS
  • IBOnlinePlugin - for online quotes IB TWS
  • IBOrderPlugin - for order placement IB TWS
  • TAPlugin - for technical analysis functions

Here some working examples:
1. Online quotes mode:


robot do
  # loading plugins, first must be plugin for query
  plugin DSL::IBOnlinePlugin, DSL::IBOrderPlugin, DSL::TAPlugin
  # online quotes mode configuration with bar duration = 10 seconds
  online :duration => 10
  # contract specifications YM symbol future on ECBOT exchange with 200712 expiry date
  YM.ECBOT FUT, USD, 200712
  # main loop: query online quotes for YM
  query YM do
    if (ema YM, 9)/(ema YM, 25) - 1 > 0.05
      # place buy market order with size = 1 for YM future
      order YM, BUY, MKT, 1
    end
    if (ewa YM, 9)/(ewa YM, 25) - 1 < -0.05
      # place sell market order with size = 1 for YM future
      order YM, SELL, MKT, 1
    end
  end # query
end # robot

Leave a Reply