Hello,
I was wandering why sometimes some of my algorithms result in huge gains on daily backtests and results in huge losses on minute backtests. Is there some way to modify the code to trade like in a daily backtest when in a minute backtest or when live trading.
#buys and sells 3X ETFs
# Put any initialization logic here. The context object will be passed to
# the other methods in your algorithm.
def initialize(context):
context.stocks=[sid(32272), sid(39214), sid(32269), sid(39215), sid(32270), sid(38533), sid(32271), sid(39216), sid(33209), sid(33208), sid(39217), sid(38564), sid(37515)]
# Will be called on every trade event for the securities you specify.
def handle_data(context, data):
for stock in context.stocks: #this applies all within it to the stocks in context.stocks
if stock in data:
order_target_percent(stock,0.07692307692)
Since I could only attach one backtest, I put up the minute one because it takes a while. Sorry I don't have a longer backtest.
Thanks,
Nick