How would one be able to say "If SPY falls by 1.5% within a one-day period, sell SPY and do not buy for rest of day/week"?
I Tried
if data.can_trade(context.spy) and bought_in == True and ((current_priced <= yesterdays_priced - (yesterdays_priced*0.015)) == True).bool():
order_target_percent(context.spy, 0)
bought_in = False
But it wont work, I assume due to the algo just recognizing a buy opportunity a few minutes later.