Could someone please explain to me why the algo is only running the first stock (shortone) and not the others (shorttwo, marketone, ), and a possible fix? Appreciate any help!
context.shortone = sid(8089)
context.shorttwo = sid(28326)
context.marketone = sid(27437)
bought_in = False
if data.can_trade(context.shortone) and bought_in == False and ((current_pricea > 45.00) == True).bool():
order_target_percent(context.shortone, 0.35)
bought_in = True
elif data.can_trade(context.shortone) and bought_in == True and ((current_pricea <= 45.00) == True).bool():
order_target_percent(context.shortone, 0)
bought_in = False
if data.can_trade(context.shorttwo) and bought_in == False and ((current_priceb > 27.00) == True).bool():
order_target_percent(context.shorttwo, 0.20)
bought_in = True
elif data.can_trade(context.shorttwo) and bought_in == True and ((current_priceb <= 27.00) == True).bool():
order_target_percent(context.shorttwo, 0)
bought_in = False
if data.can_trade(context.marketone) and bought_in == False and ((current_pricec > 41.00) == True).bool():
order_target_percent(context.marketone, 0.20)
bought_in = True
elif data.can_trade(context.marketone) and bought_in == True and ((current_pricec <= 41.00) == True).bool():
order_target_percent(context.marketone, 0)
bought_in = False