None of the companies are tradable in my model, where is my error?

Back

Hey guys i tried to get this strategy working yesterday but it tells me that none of my companies are tradable.
The strategy is migrated from Quantopian.
It should select a bunch of liquid companies that get ranked by momentum and value criterias. If we are in a market uptrend it should buy up to 50 of these well performing companies. Once a company in the portfolio drops out of the top 50 companies we liquidate it.
All cash should be funneled into bonds.

It appears like the algorithm is technically working correctly but once it wants to set a position the stock appears to not be tradable. I checked some of them and they were definitly listed to that time.
I also ran the code with a IsTradable check which resulted in no positions getting filled.

Can you help me find my error? I simply dont see it and probably stared to long at this code.

 

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.


Hello Leon,

I think your fine universe function is returning [] when the time to rebalance is due, the universe is basically empty when the scheduled function triggers.  Unvierse selection happens every day.

Maybe you should be returning self.symbols in the else clause, that would be locked to the previous fine evaluation. Also, the algo seems to be trying to operate at 10:30 in general, but it is subscribed to daily data, all price will probably be stale at that point.

Hope this helps.

0

Hi Leon,

The algorithm is filling at stale prices because it subscribes to daily data but trades at a scheduled event set to trigger intraday. We recommend using minute resolution data with scheduled events or place the orders in the OnData method that is called just once with daily data.

We can setup the algorithm to use minute data with

self.UniverseSettings.Resolution = Resolution.Minute

See the attached backtest for reference. Going forward, we recommend replacing the daily History method calls with some consolidators.

Best,
Derek Melchin

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.


Thanks a lot! It was a combination of both. I changed it to Minute Data and return self.symbols not an empty array.
It doesnt truly do what i want yet but i am getting closer.
Thanks guys :)

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