Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Stop-loss order as a function of peak price.

Hello all! I have been interested in this platform for a while, but am just now starting to try some things out. So, I have a question.

I am curious to know if there is a way to submit a stop-loss order as a function of the peak price of an individual stock? Basically If "stock X" drops below "X%" of the peak price while the stock is held, a stop-loss order would be executed.

Thanks!

2 responses

@Torry D., You can do either algorithmic trailing stops based on peak price (highest high during position). Or you can do actual entry of Stop orders which you'll have to then manage with cancel/replace logic.

There are various examples here of TrailingStop to accomplish the algorithmic method. Or you could take the same trailing stop code and amend it to perform the stop order inquiry, the initial submission, the test to see if a new stop is required, the cancellation of the prior stop order and the submission of the new order at the new price. The first is done (search the forum). The second... might be done, I haven't searched for that specific functionality here.

Thanks! I'll check it out.