Hi Guys
I'm new to QC. I would like to automate some of my daytrading setups. I have briefly read all the documentation, but did not see any clear discussions on picking a symbol set before the open.
For example if I want create an algo that would do the following:
1. at 9:20AM pre-market, find symbols (equity) that are over $1 and under $10, where the last price at 9:20AM is > 20% from previous days closing price.
2. volume at 9:20AM must be > 200k
3. Get the highest high between yesterday's close and 9:20AM (pre-market high)
4. After the market opens go long on break of PM high.
How would i go about doing that.
Is there a sample algo already written that does something similar to this?
Thanks for any help.
Alexandre Catarino
Since your algorithm creates an universe of symbols that fall under some criteria, you should start developing a Universe Selection algorithm. In the Coarse Universe, we have price and volume information, the ingredients for your selection. However, since you need the previous close, please save it in a dictionary:
private Dictionary<Symbol, decimal> _prevClose; // In Initialize AddUniverse(coarse => { var symbols = (from c in coarse where _prevClose.ContainsKey(c.Symbol) where c.Price > _prevClose[c.Symbol] * 1.2 where c.Price > 1 where c.Price < 10 where c.DollarVolume > 200000 orderby c.DollarVolume descending select c.Symbol).Take(50); foreach (var c in coarse) { if (_prevClose.ContainsKey(c.Symbol) { _prevClose[c.Symbol] = c.Price; } else { _prevClose.Add(c.Symbol, c.Price); } } return symbols; });
After this pre-selection is done, you need to make a History Request to fetch the High for each symbols and continue with your trading logic.
Dean Gutierrez
thanks Alexandre, will try it out
Kbsaravana
Dean Gutierrez , I'm also interested in that pre-market gap analysis, If you dont mind, could you share the code?
Jared Millman
Hi, I'd love that code as well. am trying to implement something similar. I have been looking for patterns with a data scientist and wanted to implement some of the strategies. I am looking for gap ups 30% and making a decision on the first three 5 min candles for a trade at 9:45-9:50. Â I wasn't sure how accurate a program like this would be real time since it would have to calculate gap ups. Â I assume that would take time and didn't know if there were limits.
 I'd love to share work.
Thanks!
Â
Louis Szeto
Hi Jared
We recommend using self.History method with extended market hour data for additional filtering:
Best
Louis
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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Dean Gutierrez
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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!