Hi evryone,
I try to test the Day of week, when i lunch a Debug line, i get my message but not the day of the week, someone can test ? I think my condition is not respected because if i make a loop up with goto this block the algo.
DateTime dt = Time;
if (dt.DayOfWeek == DayOfWeek.Friday && Time.Hour >= 15 && Time.Minute > 56)
{
Debug("FRRRRRRRRRRRRRRRRRRRR" + dt.DayOfWeek);
}
if (dt.DayOfWeek == DayOfWeek.Monday && Time.Hour < 9 && Time.Minute < 01 )
{
Debug("MMMMMMMMMMMMMMMMONNNN" + dt.DayOfWeek);
}
if (dt.DayOfWeek == DayOfWeek.Saturday)
{
Debug("SAAAAAAAAAAAAAAAATTTTTTT" + dt.DayOfWeek);
}
if (dt.DayOfWeek == DayOfWeek.Sunday)
{
Debug("SSSSSSSSSSSSSSUNNNNNNNNN" + dt.DayOfWeek);
}
Thanks,
Jason Mark
Hi Gmamuze,
Try addingÂ
Debug(Time.ToString());
in the beginning of your OnData(Slice data) method. It is of hard to tell what is going on without knowing the Resolution of your equities but if you are usingÂ
AddEquity("SPY", Resolution.Daily);
OnData(Slice data) is called Tuesday, Wednesday, Thursday, Friday, and Saturday at 12:00:00 AM.
Â
Alethea Lin
Hi Gmamuze,
Please use the following code to see that the DayOfWeek is correctly printed and the boolean statement correctly checks the day of the week.Â
Debug(Time.DayOfWeek.ToString());
Debug((Time.DayOfWeek == DayOfWeek.Friday).ToString());
Hope this helps!
Gmamuze Cht
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!