Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Tracking stock execution level

I am wondering if it is possible to track the level executed on an order to build a stop and or take profit off that level?
if so, would it be possible to use that level plus a formula inside the original order such as: order(context.stock, int(cash/current_price), style=StopLimitOrder(filled_px + (2 * atr), (1*atr) - filled_px))?

1 response

I think the best you can do is get the average cost basis of the position. Stops are pretty tedious to manage, especially trailing stops that you need to ratchet, and especially if you care about keeping the stop amount consistent with slow fills (probably not worth the trouble).