I thought when short selling a stock, if the current price is <= stop price, the stop limit order should be turned into an limit order, the order won't be filled if the following price jump below the limit price. eg: stoplimit(limit= 25.01, stop= 25.03,amount=-100), if current price hit 25.03, the short selling will ensure the order won't be triggered below 25.01.
If I understand correctly, In backtest
order_target_percent(sid,sids[sid]*factor,style=StopLimitOrder(data.current(sid,'price')*0.998,data.current(sid,'price')*1.005))
should gave a better result compared to
order_target_percent(sid,sids[sid]*factor,style=StopLimitOrder(data.current(sid,'price')*0.998,data.current(sid,'price')))
as the stopprice=data.current(sid,'price')*1.005) is more aggressive . But In my backtest, the 1.005 version actually gave a much worse result.
Edit: a stop price = data.current(sid,'price')*1.1 gave the same result as stop price = data.current(sid,'price') as expected. It fills without looking.
What is going on ??