Also, a second question, If my PC is in a timezone that has a different Daylight Saving Time than that of the exchange I am trading, is there a way to check the DST of the exchange timezone, and not the DST of my PC timezone? I haven't found something that can give me that in the NT8 reference, I'm probably missing something obvious.
Notes:
DSTSH- Specific starting hour depending on if we are in DST or not.
DSTEH- Specific ending hour depending on if we are in DST or not.
Code 1:
Currenttime = Times[1][0];
CurrentTime = Currenttime.ToUniversalTime().TimeOfDay;
if(CurrentTime.CompareTo(new TimeSpan(DSTSH,0,0)) > 0 && CurrentTime.CompareTo(new TimeSpan(DSTEH,5,0)) < 0 && DS == 0)
{
Do some calculations
}
// check for 5 mins after the end hour is past
if(CurrentTime.CompareTo(new TimeSpan(DSTEH,5,0)) == 0)
{
StartTime = Times[1][0];
EndTime = StartTime.AddHours(8);
Draw.Line(this, "Line"+CurrentBar, false, StartTime, orangeLine, EndTime,orangeLine, OC, OL, OS,true);
}
CurrentTime = Times[1][0];
if ( CurrentTime.AddHours(HoursFromEST*-1).ToUniversalTime().Hour >= DSTSH && CurrentTime.AddHours(HoursFromEST*-1).ToUniversalTime().Hour <= DSTEH && DS == 0)
{
Do some calculations
}
// check time has passed the end hour
if (CurrentTime.AddHours(HoursFromEST * -1).ToUniversalTime().Hour == DSTEH && CurrentTime.ToUniversalTime().TimeOfDay.Minutes == 0)
{
StartTime = CurrentTime;
EndTime = StartTime.AddHours(8);
Draw.Line(this, "Line"+CurrentBar, false, StartTime, orangeLine, EndTime,orangeLine, OC, OL, OS,true);
}

Comment