Any way to tell that a week is a shorter week (< 5 trading days)? I want to use this to decide whether I want to open a trade in the week. Thanks.
Rename
This should work.
CODE:
public int TradingDaysNextWeek(BarHistory bars, int bar) { //add days until Sunday DateTime dt = bars.DateTimes[bar]; while (dt.DayOfWeek != DayOfWeek.Sunday) dt = dt.AddDays(1); //find the Saturday DateTime dt2 = dt.AddDays(6); return bars.TradingDaysBetweenDates(dt, dt2); }
Your Response
Post
Edit Post
Login is required