Hi, I've just started using the QuantConnect platform and am impressed with the functionality. I am having some difficulty allowing leverage in my backtests, basically I am trying to increase day trading buying power by 4x the amount of cash, as most brokers allow. From the docs and this post: 

https://www.quantconnect.com/forum/discussion/500/update-margin-calls-and-portfolio-modeling

the typical way to do this is something like:

self.Securities["AAPL"].MarginModel = PatternDayTradingMarginModel()

within the Initialize() function. However, I am using a CoarseSelectionFunction to get a new list of stocks every day, and as far as I can tell self.Securities is not populated in Initialize() or onData(). I'm wondering if I am still able increase leverage/buying power while still using CoarseSelectionFunction? I also tried setting:

self.UniverseSettings.Leverage = 4

within Initialize(), but it did not seem to do anything when looking at the difference between self.Portfolio.MarginRemaining and the cost of of a new position within onData(). Thanks.

Author