Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Never be able to get Stop Order to work

Hello all,
I was trying to test how does stop order work in Quantopian but it failed every time. please see line 58 from the attachment, in this case, I put Stop order price as $1000.0 for APPL but it seems like the order still get filled in 10 minutes. The order was treated as Market order by system.
can anybody help to review the code and tell me what I did was wrong, how do I correct it?
thank you in advance.
saw bird

2 responses

A stop sells if the price is below the stop price, for long, so that's working fine above. Your stop is set to 100 while AAPL is around 94 so it always acts right away.

Adding track_orders

that explains it! thank you Seahawk and the Trackorder function is very cool, it is much appreciated!
In this case, I was trying to set up a Take Profit order and Stop Loss order for the current purchase, I should use Limit order to do Take profit and use Stop order to do stop loss then. I will give it a try.
thank you again.