I'm testing a strategy where I filter the coarse universe to contain only the equities I want based on indicator values. The strategy creates limit orders once a day in the OnData event and in the initialize I'm using self.UniverseSettings.Resolution = Resolution.Daily. It all seems to work ok but the fill times are also always once a day at midnight, which of course is not reality as they happen at different times a day.
2020-02-11 00:00:00 BUY 217 RARX WF1LTBB6PZ6T AT LIMIT 46.15 UTC Time: 2020-02-11 05:00:00+00:00 (Logged from OnData)
2020-02-12 00:00:00 'RARX WF1LTBB6PZ6T' filled at '2020-02-12 00:00:00' (Logged from OnOrderEvent).
How can I get the fill times to come to backtesting throughout the day? Do I need to drop the self.UniverseSettings.Resolution = Resolution.Daily and start using faster resolution? This filll time handling is the only missing piece from the strategy and I'd rather not have the OnData triggered all the time as it is not necessary for daily signals.
Thanks in advance for possible comments!
Rahul Chowdhury
Hey Ville,
OnData is called each time a new set of bars for your securities is available. This means that for daily data, it is called at the end of the day.If we are using daily resolution, limit orders will only be evaluated once per day because there is no intermediate data. On live mode, limit/stop orders aren't similarly restricted because the orders are filled with real time data.
If you wish to have more fine control of when your orders are executed, you should use a higher resolution like hourly resolution. You can still trade your algorithm on daily signals by using daily consolidators.
I also recommend you check out the bootcamps. Here's one that covers consolidators.
Ville Vainio
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!