Back

Filter for equities up 10%+ on the day

Hello,

I would like to copy the concept of the Coarse Selection Filter as it's laid out in the "Liquid Universe Selection" Tutorial in QuantConnect's Boot Camp.  But instead of filtering by dollar volume and picking the 8 symbols with the highest dollar volume, I would like to filter by largest daily gainers and pick all of the top gainers that are up 10% or more on the day.  Would anyone mind helping me put that together?  Or point me in the right direction to find how to substitute in % gain instead of dollar volume?

Thanks!

Sean

 

Here is the "Liquid Universe Selection" Tutorial I'm following with the Coarse Selection Filter part beginning at 2:37    

https://www.youtube.com/watch?v=rf7t5K1Bczc

 

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.


Hi S O'Keeffe,

In our coarse selection, we can make a history call that retrieves the last close and uses that to find the daily returns.
Then we can filter for symbols with daily returns greater than 10%.

In this example, we created a SymbolData class which can hold the relevant data for each symbol, such as the daily return and last close. Check out the comments inside to see how it works.

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.


This is awesome thank you Rahul!  I backtested the last two days, and it seems to be trading a lot of ETF-type symbols.  It didn't trade CLR or FRO on 3/10 but both of those were over 10% up on the day.  Do you know why those were not traded by the algorithm?  Is it because FRO opened 9% up from its previous close?  Is there a way to keep a rolling look during the day so that any equity that moves over that 10% gain threshold during the day, it will also get added to the buy list?  Thank you so much for your help! 

0

Hi S O'Keeffe,

FRO was not selected because it was not in symboldict since it was not included in the top 1000 liquid stocks in the previous days.

CLR was not selected because of a more subtle reason. If we replace the code block starting at line 36 with

for c in coarse:
symbol = c.Symbol
if symbol in self.symboldict:
self.symboldict[symbol].Update(c.AdjustedPrice)
if symbol.Value == "FRO" or symbol.Value == "CLR":
self.Debug(f"symbol: {symbol.Value} with returns: {self.symboldict[symbol].dailyReturn}")
else:
if symbol.Value == "FRO" or symbol.Value == "CLR":
self.Debug(symbol.Value)

We can first see that FRO did not make it into symboldict. Then we can see that CLR has a daily return of -52%. This is because universe selection for trading on 03/10 is done at midnight:

2020-03-10 00:00:00: symbol: CLR with returns: -0.5262803234501348

The close price of trading on 03/09, 7.03, is compared to the close price of the trading day prior 03/06, 14.84. This means the daily return of CLR at the time of universe selection on 03/10 was -50%. Universe selection for 03/10 can not be done with the market open price on 03/10 because that would introduce a forward bias in our data.

Instead, if you wish to create signals on overnight gaps, you can use a scheduled event at market open. The Fading The Gap bootcamp covers a strategy which utilizes this type of scheduled event

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.


Thank you again Rahul!  OK I was hoping CLR and FRO would be seen as 10%+ gainers based on the close price 3/9 compared to the open price 3/10.  I will review the Fading the Gap bootcamp

0

Hi Rahul sorry do you still have time for questions!  Is it possible to use the "Fading the Gap" strategy at Second resolution instead of Minute resolution?  And if I want to look at all Nasdaq stocks instead of just looking at one equity, how can I accomplish that?  Trying to look at all Nasdaq stocks and screen through them based on highest overnight gap is why I initially started with the "Liquid Universe Selection" Tutorial.

My end goal is to buy short squeezes.  I want to buy Nasdaq stocks when they break through their HOD if they are up more than 10% for the day.  And then sell them pretty quickly as they squeeze up higher.  Or sell them quickly at a safety stop if they begin to break down lower.

0

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