Here is a simple backtest that uses an if statement to execute a limit order, in essence a stop limit.  In this case the stop and limits are set at absurd points, 0.9% (stop) and 50% (sell limit) of the previous close price.  The goal was to gaurantee a trigger in extended hours but everything waits till the next morning and gets submitted at either 9:31 or 9:32 (another oddity - note execution times are in the logs 1 minute after they're submitted)  Extended hours = True and resolution.Minute.

If I set up a scheduled event to fire in extended hours I can get that to work, but not a limit order submitted during normal hours.

Any thoughts?

Logs of OnOrderEvent.Status = Filled

2017-01-17 15:59:00 : Buy 101.0 @ 9.81 2017-01-18 09:32:00 : Sell -101.0 @ 9.46 Loss: -0.03567787971457692 2017-01-18 15:59:00 : Buy 97.0 @ 9.895 2017-01-19 14:21:00 : Sell -97.0 @ 9.77 Loss: -0.012632642748863063 2017-01-19 15:59:00 : Buy 96.0 @ 9.8 2017-01-20 12:34:00 : Sell -96.0 @ 9.675 Loss: -0.012755102040816325 2017-01-20 15:59:00 : Buy 96.0 @ 9.74 2017-01-25 10:11:00 : Sell -96.0 @ 10.29 Loss: -0.014367816091954057 2017-01-25 15:59:00 : Buy 95.0 @ 10.35 2017-01-30 09:33:00 : Sell -95.0 @ 10.45 Loss: -0.020618556701030986 2017-01-30 15:59:00 : Buy 94.0 @ 10.605 2017-01-31 09:43:00 : Sell -94.0 @ 10.44 Loss: -0.015558698727015645 2017-01-31 15:59:00 : Buy 94.0 @ 10.388

 

Author