HI Michael
Best feature but correct me if im wrong on the logic here.
Your universe changes at 12, but you still have the old stocks with open positions, thus they are still a part of the universe. You then call on tradebar and it buys everything in the universe again, which creates an odd loop and the algo seems to not always buy/sell as is in the excel.
I tried something like
var percentage = 1m/_backtestSymbolsPerDay[Time.Date].Count;
foreach (var symbol in _backtestSymbolsPerDay[Time.Date])
{
SetHoldings(symbol, percentage);
}
It then only sets the holding to the new symbols, rather than the entire active universe. Just something you might want to look at.
I am trying to figure out a couple things still
A. Can I remove tickers from the universe as well ? My universe keeps growing until it reaches 500 and then stops due to the limit/
B. Now that you dont add every stock seperately, how can I change the transaction model of the universe to a flat fee one ?
Thanks again for the feature already seeing some great results. Also the engine seems to handle missing securities that are not available in your database a lot better now which is a nice added bonus.
Regards
Daniel
Alexandre Catarino
Please share an algorithm (use the attach backtest button below) that shows the issue you are experiencing.
This procedure helps us, the community, to answer your questions quickly and effectively.
When we try to remove a security from the universe, we check whether it has holdings and/or open orders, because we need to a subscription (in other words, need to keep it in the universe) to trade that security. So you need to liquidate its positions and/or close its open orders to finally remove it:
# this event fires whenever we have changes to our universe def OnSecuritiesChanged(self, changes): for security in changes.RemovedSecurities: if security.Invested: self.Liquidate(security.Symbol) self.Transactions.CancelOpenOrders(security.Symbol, 'Removed from universe')
When we are dealing with universes (equity, options, and futures), we can to set a "global" security initializer.
Please check out the RawPricesCoarseUniverseAlgorithm for a complete example.
Nguyenthaonhi
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!