I'm trying to limit the OBU calculations to the current session.
To limit to the present day I know how to do:
if(Time[0].Year == DateTime.Now.Year && Time[0].Month == DateTime.Now.Month && Time[0].Day == DateTime.Now.Day)
{
canstart = true;
}
if(!canstart)
return;
But how to do it?
I've tried all sorts of things with this:
if (Bars.IsFirstBarOfSession)
{
sessionIterator.GetNextSession(Time[0], true);
year = sessionIterator.ActualSessionBegin.Year;
month = sessionIterator.ActualSessionBegin.Month;
day = sessionIterator.ActualSessionBegin.Day;
hour = sessionIterator.ActualSessionBegin.Hour;
minute = sessionIterator.ActualSessionBegin.Minute;
second = sessionIterator.ActualSessionBegin.Second;
barsAgo = CurrentBar - Bars.GetBar(new DateTime(year, month, day, hour, minute, second));
//sessionIterator.IsInSession(Time[0], true, true);
}

Comment