PDA

View Full Version : Daylight Saving Time US and Europe


xmms1
09-09-2009, 09:19 AM
In US, DST changes on second sunday in March and on first sunday in November. But in Europe, on last sunday in March and on last sunday in September.

I am from Europe and I have to trade US futures one hour earlier at these times. I'am working on my automated trading strategy and I need to correct the times by a script and don't know how.

I'd like to make a test like this:

if (today localtime is summertime
&& today US time is summertime)

{ trade as usual }
else { trade one hour earlier }

Is there any C# function to do this?

NinjaTrader_Josh
09-09-2009, 09:33 AM
xmms1,

You can try searching google or MSDN for daylight savings for DateTime objects.

Baruch
09-09-2009, 09:43 AM
Just change the time of the computer to CST. That's what I did.

Baruch

xmms1
09-09-2009, 10:18 AM
I don't want to change the time. I want to trade using my time. I am trying to find a C# method but nothing suitable found. I'm not a programmer.

NinjaTrader_Josh
09-09-2009, 10:25 AM
Doing so may require programming. Unfortunately if there is no pre-built method you would have to create your own. I am sure there are some code snippets to do so on google, but unfortunately this is beyond the scope I can offer support for. Thank you for understanding.

Ralph
09-09-2009, 12:43 PM
Hi xmms1,

there is indeed a function which tells you, if your local computer time is daylight saving time: DateTime.IsDaylightSavingTime. But it doesn't solve your problem with US DST.

Here is a proposal for a patch (quick and dirty):
Define two groups of three variables for your strategy: DaylightSavingStart, DayLightSavingStop, Offset

Offset is the hour-delay for the timeperiod of concern. If you define that for both US and EU-Time, then you could compare against the current Date/Time of your strategy and offset the trading time accordingly.

Regards
Ralph