Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Trailing Stop, How to refill stop orders?

Hi Quants,

Got my algorithm working, but I want to add more. I am looking at Benjamin Graham Fundamentals, and trying to find value in the mkt. I buy on the 3rd day of the month 10 stocks.

I have a function trail_stop, and this contains my trailing stop for the stocks. The stop works well, but when I lose too many orders I lose my leverage, since I only buy at the start of the month. This gives too much time for no return.

My goal would, obviously, be to refill those orders with either other stocks in my pipeline, or some kind of hedge system. Right now, I am shorting the VXX on a moving average.

If the leverage is calculated everyday in the function count_positions, then why can I not
hedge=1-(current_leverage)
And find the hedge that makes my algorithm 1.0?

1 response

Hello Quantdog,
Every time a position is added or liquidated your hedge is going to change. You may be better off trying to stay within an acceptable range. You could also add another schedule_function that could calculate your hedge before it is needed or something to that effect.
Hope that helps.