Hi!
I am trying to backtest a strategy that only trades on weekends. However, when I use the TradeBarConsolidator passing timedelta=7 or Calendar.Weekly it always runs on Tuesdays.
Is there a way I can consolidate data every saturday or friday after market close regardless if the consolidated data has 4 days (if there is a holiday) or 5 days.
Mak K
Hi Dario Teodori ,
Could you share a backtest for this please?
Also what assets are you trying to trade here?
Thanks!
Dario Teodori
Hi Mak,
I am scanning SP500. I am using the following parameters too which you wont see in the code.
Thanks,
Dario
Mak K
Thanks,
How would you want to trade on the weekend? Equity Market's are closed over the weekend.
Dario Teodori
I consildate weekly and place market orders monday morning only
Fred Painchaud
Hi Dario,
Short comment. I did not test this but in live mode, your algo should run 24/7. You might be able to set a scheduled rule:
self.DateRules.Every(DayOfWeek.Saturday)
to compute your "consolidation".
But I would personally develop my own indicator for that capable of detecting Mondays (and Tuesdays, … - in case Monday was a holiday…), trade on accumulated data and then reset so it can accumulate new data for the week to come. One easy way would be to detect Saturdays and Sundays and set a boolean “TimeToTrade” to True. Then, whenever your algo detects new data and that the indie is saying “TimeToTrade”, it trades, reset its data and reset “TimeToTrade” to False.
Something like that…
Fred
Dario Teodori
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!