Hey guys!
I am eager to get started on paper trading this one algorithm in particular. This will be my first time so was just seeing if anyone more experienced had some advice they wish they knew before going live for their first time.
One concrete question does come to mind though, if you ‘restart’ the algorithm, will it also restart the warm up period, rendering your algorithm useless for the amount of days it is being warmed up for?
Thank you so much,
Jesse
Derek Melchin
Hi Jesse,
To ensure the algorithm starts trading immediately, call the SetWarmUp method or warm up the algorithm manually with a history request.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
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.
Jesse Fleming
Thank you!
so if i have SetWarmUp period in initialize, i should be okay?
Thank you for your time,
Jesse
Derek Melchin
Hi Jesse,
If we add SetWarmUp, LEAN winds back the clock and pumps data into the algorithm before the deployment time. If the algorithm uses the warm-up data to correctly warm up any indicators and lookback windows, it should allow the algorithm to start trading immediately. For further assistance, please attach a backtest of the algorithm.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
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.
Jesse Fleming
Thank you so much for taking the time to respond to me. Just to verify because of course it would be very costly if I somehow misunderstood you.
Take this template for instance, I have the warm up set to 70 days. If I deploy this algorithm and restart it upon deployment, will it go back 70 days automatically and start paper trading correctly immediately?
Jesse Fleming
class CombinedAlgorithm(QCAlgorithm):
def Initialize(self):
# INITIALIZE
self.SetStartDate(2020, 8, 1) # Set Start Date
self.SetEndDate(2021, 12, 12)
self.SetCash(10000) # Set Strategy Cash
self.symbol = self.AddEquity('TSLA', Resolution.Minute)
self.symbol.SetDataNormalizationMode(DataNormalizationMode.Raw)
# SCHEDULED EVENTS
self.Schedule.On(self.DateRules.WeekStart(self.symbol.Symbol), self.TimeRules.AfterMarketOpen(self.symbol.Symbol), self.WeekStart)
self.Schedule.On(self.DateRules.WeekEnd(self.symbol.Symbol), self.TimeRules.BeforeMarketClose(self.symbol.Symbol), self.WeekEnd)
self.Schedule.On(self.DateRules.EveryDay(self.symbol.Symbol), self.TimeRules.BeforeMarketClose(self.symbol.Symbol, 5), self.ParabolicBarCheck)
self.SetWarmUp(timedelta(days = 70))
# CONSOLIDATED DATA
# ATR
atr_consolidator = TradeBarConsolidator(timedelta(days=1))
self.SubscriptionManager.AddConsolidator(self.symbol.Symbol, atr_consolidator)
atr_consolidator.DataConsolidated += self.ATRDayBar
self.atrBarWindow = RollingWindow[TradeBar](14)
# Daily Bars
dailyConsolidator = TradeBarConsolidator(timedelta(days=1))
self.SubscriptionManager.AddConsolidator(self.symbol.Symbol, dailyConsolidator)
dailyConsolidator.DataConsolidated += self.OnTwoDayBar
self.dayBarWindow = RollingWindow[TradeBar](2)
# Weekly Bars
weeklyConsolidator = TradeBarConsolidator(Calendar.Weekly)
self.SubscriptionManager.AddConsolidator(self.symbol.Symbol, weeklyConsolidator)
weeklyConsolidator.DataConsolidated += self.OnTwoWeekBar
self.weekBarWindow = RollingWindow[TradeBar](2)
# CUSTOM CHART
log_plot = Chart('Custom Chart')
log_plot.AddSeries(Series('Orders',SeriesType.Scatter,0))
log_plot.AddSeries(Series('Symbol Price', SeriesType.Line,0))
self.AddChart(log_plot)
def OnData(self, data):
if self.IsWarmingUp:
return
# ENTRY AND EXIT CODE HERE
Derek Melchin
Hi Jesse,
It's impossible to know if the algorithm will be immediately ready to trade without the full algorithm. To test if it will be ready, in OnData, add
You can extend this guard to check if all your indicators and RollingWindow objects will be ready when the algorithm is done the warm-up period.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
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.
Jesse Fleming
Thank you my friend.
Jesse Fleming
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!