Back

No order being placed with SetHoldings

I am using this algorithm as a base to create my own and I still can't seem to get set holdings to work. Does anyone know why?

 

Thank you in advance!

Update Backtest







There is no algorithm attached =)

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.


Just attached it, I thought I did the first time but did not select a backtest. My bad. 

0


Thanks for attaching the backtest! The reason why SetHoldings was not working was because the code was not being called. After Initialize() the algorithm finished running. In order to fix this the code in rebalance() was put inside OnData(), since OnData() is a built in handler that uses the initialized data. The Resolution of the data was set to Daily and there was no scheduled event calling rebalance(), so I assumed the rebalancing was meant to be called Daily. The backtest below has the algorithm built and running. If the rebalancing was supposed to occur at a different time the link below has documentation on how to implement that:

https://www.quantconnect.com/docs/algorithm-reference/scheduled-events
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