View Full Version : Optimize on DayOfWeek
brooksrimes
05-18-2010, 12:57 PM
As part of my optimization, I'd like to pass in a variable to represent DayOfWeek.
Does Time[0].DayOfWeek have an integer equivilent?
In Excel, Sunday = 1, Monday = 2, etc.
Brooks
NinjaTrader_RyanM
05-18-2010, 01:29 PM
Hello brooksrimes,
Unfortunately this is not available. As a training exercise I am working on a simple script that will allow this. If everything checks out I will share with you tomorrow.
NinjaTrader_RyanM
05-19-2010, 08:16 AM
brooksrimes,
Below are the results of this:
http://www.ninjatrader.com/support/forum/local_links.php?action=sendtofriend&catid=2&linkid=313
brooksrimes
05-19-2010, 08:42 AM
Thanks Ryan, I'll take a look at it. Yesterday, I came up with:
// Monday
if (Weekday == 1 && Time[0].DayOfWeek == DayOfWeek.Monday
...
{
EnterLong(1, "Long1");
}
// Tuesday
if (Weekday == 2 && Time[0].DayOfWeek == DayOfWeek.Tuesday
...
{
EnterLong(1, "Long1");
....