I am experimenting backtest with basic algorithm that is posted on site with TWTR and made change to vwap to 10 days from 3 days.
Question. I am running backtest from 02/04/2014 to 06/02/2014 where stock price went from $65 to $30 but backtest only give me 6.29% profit. Can someone explain what is this number represent. My expectation would be more than 6% since most of these time stock was going down so I would be holding short for long time. Any comment? Advice?
def initialize(context):
context.twtr = sid(45815)
context.max_notional = 40000.0
context.min_notional = -40000.0
def handle_data(context, data):
vwap = data[context.twtr].vwap(10)
price = data[context.twtr].price
notional = context.portfolio.positions[context.twtr].amount * price
record(cash = context.portfolio.cash)
if price < vwap * 0.995 and notional > context.min_notional:
order(context.twtr,-100)
log.info("Selling %s" % (context.twtr))
elif price > vwap * 1.005 and notional < context.max_notional:
order(context.twtr,+100)
log.info("Buying %s" % (context.twtr))