Back

NOOB question. How to do QC500 intraday universe selection for top gainers since previous close?

Hi all,

I'm brand new to the platform. Looking for advice on 2 questions.

1. Lets say at 10am, how would I find the top 50 stocks (in SP500 or QC500) by percentage gain since previous close? And then for example go long those stocks. Is this possible in quantconnect?

2. Let's say my strategy involves doing the above, but I want to keep track of the top 10 stocks that performed best doing this strategy for the last 5 days. So that on day 6 I can add these to my signal, whats the best way to do this?

 

Thank you!

Update Backtest







0

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.


Hey Allan,

We can use QC500UniverseSelectionModel to add the QC500 stocks into our universe.

Whenever we add a new stock, we make a history call for the first previous close data point. After that, we will update the previous close for that stock with a scheduled event that stores the close value at market close.

Then another scheduled event, Rebalance, that fires everyday 30 minutes after market open will pick out the top 50 stocks with the largest gains.

Everyday at market close in our scheduled event, we liquidate all our shares and repeat the process the next morning.

Every friday, another scheduled event determines our top performers for that week. We accomplish this by keeping track of the returns for each symbol. We store the returns of each trade every day before market close in a dictionary keyed by symbol.

Check out the comments in backtest for more details.

1

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.


Update Backtest





0

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.


Loading...

This discussion is closed