I'm trying to make decisions using standard deviation during trading days in another algorithm, but I've noticed that when prices and indicators change significantly during extended hours, it mistakenly throws off standard deviation thinking that levels have taken a significant jump from 4pm to what it thinks is the next step 9:30 the next day.
I'd like to be able to feed my consolidator with extended hours data so that things like standard deviation and other indicators like moving average etc can correctly follow the flow of data during extended hours and into the next trading day. I've tried adding the parameters "fillDataForward=True" and "extendedMarketHours=True" but these don't seem to be adding data to my consolidator. I've also tried making Resolution.Second also with no change. Any ideas/suggestions?
Jonathan Ganucheau
I can see in the source code here that SubscriptionDataConfig accepts parameters for extendedMarketHours and fillDataForward (lines 86 & 87 and 137 & 138), but I'm seeing a way to push those parameters to self.SubscriptionManager or AddConsolidator for consolidators to be including that extended hour data.
Jonathan Ganucheau
I meant to say I'm NOT seeing a way to push those parameters. Anyone know of a way to do this in Python?
Rahul Chowdhury
Hey Jonathan,
Named parameters are currently not supported. To enable extended market hours you need to fill in all the parameters in AddEquity.
Â
self.AddEquity("SPY", Resolution.Hour, Market.USA, true, 0, True)
Â
Jonathan Ganucheau
Thank you, Rahul! That did it! I'll have to go through my other algorithms to see if I'm using named parameters anywhere else too. I'm attaching the successful backtest with more consistent std dev and extended hours results. Thanks again!
Jonathan Ganucheau
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!