Happy New Year,
I've been trying to figure out a solution for the following,
How do I make sure to consolidate every four hours starting from 1am or ending at 9pm,
I've seen discussions advising the use of CalendarInfo but I don't know what's going on under the hood, your response will be very much appreciated.
The below are few variations of what I tried, both failed 😢
private CalendarInfo CustomPeriod(DateTime datetime)
{
var period = TimeSpan.FromHours(value: 4);
var start = new DateTime(year: datetime.Year, month: datetime.Month, day: datetime.Day, hour: 1, minute: 0,
second: 0);
return new CalendarInfo(start: start, period: period);
}
private CalendarInfo CustomPeriod(DateTime datetime)
{
var period = TimeSpan.FromHours(value: 4);
var start = datetime.RoundDown(TimeSpan.FromMinutes(240));
return new CalendarInfo(start: start, period: period);
}
Victor
KING VICTOR
I'm an idiot,
I think I got it now, I've attached a backtest.
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!