Hey,
so if I do something like:
if date == dateb1:
order_target_percent(context.jj,1)
elif date == dateb2:
order_target_percent(context.jj,-1)
with one stock (capital at the beginning: 1000) it works like expected: At the first if statement I buy 10 shares, which is appr. 100% of my portfolio. At the elif statement I sell those 10 shares (made appr. 10% retrun) an go short for -10 shares because the its appr. 100% of my portfolio.
but if I do something like:
if date == dateb1:
order_target_percent(context.jj,1)
elif date == dateb2:
order_target_percent(context.jj,0)
order_target_percent(context.jj,-1)
The if statement works the same way but after the elif statement I got -20 shares which is 200% of my portfolio.
I do not see what is happening here.
Thanks!