Hi,
I'm new to the Quantconnect platform. I am researching a cloned algorithm from Quantpaedia. When I backtest the algo and set the start date to 01-01-2019, it only places trades 5 months later. When I tried live paper trading, no orders were placed. I cannot figure why no trades are executed at the start date.
I suspect it is to do with self.lookup_period, for which I cannot find any documentation on this class. Also if I set the start date to 16-07-2020, how can I get the algorithm to trade on the 16th of every month?
Thanks in advance!
Shile Wen
Hi Mohamed,
When setting the start date to any date, the first few months will not see any trades (I've tested this by setting the date to 2016). The reason for this is because of self.SetWarmup on line 48, which warms up the algorithm with 252 (12*21) days of data, and so on line 88, the Rebalance function returns early when we do not have enough data.
As for the reason we may not see trading action immediately, this isn’t a strategy that trades frequently intraday. Looking at line 70, we see that it only makes its trades once per month through the Month Start Scheduled function. This means we will need to wait until the start of the next month until we can see any trades in live. Furthermore, it may trade in QuantConnect paper trading, but it won't trade with other brokerages because custom data is not tradeable with those. Please use our Futures instead.
Best,
Shile Wen
Mohamed Ghassan
Hi Shile,
Thank you for your detailed response. Is there any way I can set the algorithm to trade on a specified date every month. For example, can I set it to trade on the 12th of every month?
Also, can I not use Quandl data on IB due to QuantConnect limitations, or do the other brokers like IB not support custom data? I'm just surprised because many of the startegy library tutorials tend to use quandl data.
Thanks Again!
Shile Wen
Hi Mohamed,
We do not support scheduling events specifically on the 12th (to see the full list of supported DateRules, see our documentation here, and click the word “DateRules” in red with three squares to the left).
Instead, we can compare the day field of self.Time with our desired day (in this case the 12th) inside OnData to get the desired effect. I’ve shown how to do this in the backtest.
Furthermore, custom data is supported for all brokerages, however, it is buying and selling positions in the custom data (e.g. a time-series of China-only (CN) stock prices, users can simulate buying and selling CN stocks, however, we do not support CN stocks with our brokerages). The reason we allow going long and short on prices of custom data is to allow our users to backtest strategies on any financial instrument, which means they can utilize our LEAN engine even on securities we don’t support, such as the aforementioned CN stocks. However, we do support the securities traded that use the custom data for prices in the Quantpedia strategy in the form of Futures.
Best,
Shile Wen
Mohamed Ghassan
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!