Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Possible to create an intraday opening range breakout strategy?

Hi,

I'm new to Quantopian and was wondering if anyone could help me code the following strategy, or direct me to a thread with instructions on how to code something similar?

Minute interval: 30 min

Opening range Start: 9:30am
Opening Range End: 10:00am

If price crosses above opening range high, go long with a stop at opening range low.
If price crosses below opening range low, go short with a stop at opening range high.

Exit all trades at next trading day open.

Does anyone know how to do this?

Thanks a million in advance.

4 responses

Hi Steve,

It sounds like you will want to start with schedule_function() and run it in a for loop between 9:30AM and 10:00AM. While there's no builtin stop loss functionality, there's a good example of how to implement it yourself posted here. This should help get you started!

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Hey Steve. How did you get on with this. I'm interested in helping.

Steve, I found this program in python: https://github.com/troyshu/openingrangestrat/blob/master/5minOHLC.py#L1
which looks very much like what you are looking to do. I am interested in this approach also. I anyone can help convert the code to work in quantopian, it would be appreciated.

Have you guys had any luck coding this?
I have been also wanting to code a basic and these two others would love to collaborate

http://lindaraschke.net/volatility-breakout-systems/
http://www.trading-naked.com/library/[Trading]-Stocks-&-Commodities-Toby-Crabel-ORB-articles.pdf