- ago
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.
0
68
Solved
1 Replies

Reply

Bookmark

Sort
Cone8
 ( 2.74% )
- ago
#1
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);       }
1
Best Answer

Reply

Bookmark

Sort