- ago
This opens a position on Tuesday:

if (bars.DateTimes[index].DayOfWeek < bars.DateTimes[index-1].DayOfWeek)

How to open a position on Monday?
0
574
3 Replies

Reply

Bookmark

Sort
- ago
#1
For example:
CODE:
if(bars.TradingDaysRemaining(idx,HistoryScales.Weekly) == 0 )

Which means that no trading days remain in this week (hence scale is Weekly - despite that the code should run on Daily)
If Monday is a holiday the position would be opened on Tuesday.
0
- ago
#2
Another example - now this will skip a trade until next chance if Monday falls on a holiday:
CODE:
if(bars.GetNextTradingDate(idx).Date.DayOfWeek == DayOfWeek.Monday)
0
- ago
#3
OK. Thank.
0

Reply

Bookmark

Sort