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

Hey, I might sound stupid saying this, but i don't understand how a person cannot do this. Is it possible to create an algorithm that puts a trailing stop loss on a stock, and then if the stock later drops below the stop loss it sells, but if the stock rises above the stop loss, then you return a buy order? This is probably really stupid to ask, but I was just wondering.

1 response

Updated 3/29/15: with VolBias exit technique

@Jonathan R., Such a trailing stop is often called a "chandelier" indicator. It looks like a trailing stop but is not dependent upon having a position. Below you see a variation of a chandelier called a TRO, Trailing Range Offset. You can find it as an isolated code block within this strategy. Take a look at the plotted values, you'll see a price (REF), an SMA and a TRO. It's the TRO that looks like a trailing stop. The entry and exit logic are more involved than just a simple line cross, but as you can see the results are somewhat desirable.