I'm a newbie, so forgive my ignorance.
I'm trying to design an algo that buys aapl when the price breaks the high of the first 10 minute candle. I'm getting a runtime error? What am I doing wrong?
def initialize(context):
context.aapl = sid(24)
schedule_function(rebalance, date_rules.every_day(), time_rules.market_open(minutes = 10))
def rebalance(context, data):
#get this high of the first 10 minute candle
get_high = data.history(context.aapl, 'high', 10, '1m')
log.info(get_high)
price=data.current(context.aapl, 'price')
#order when price breaks 5 minute high
if price > get_high:
order_target_percent(context.aapl, 1.0)