Hi,
For my strategy I need to know the opening times of all exchanges (NY, Tokyo, Sidney, London).
So I have those parameters:
private int NYStart = 830;
private int TokyoStart = 1800;
private int SydneyStart = 1800;
private int LondonStart = 200;
Its for CST so I also have a parameter for CSTOffsetHours.
Now I need to change those opening hours depending on different DST (day light saving times).
So that is how I do it:
int MonthDay = ToDay(Time[0]) % 10000;
if (MonthDay > 313 && MonthDay < 1106) TokyoStart -= 100;
if (!(MonthDay > 403 && MonthDay < 1002)) SydneyStart += 100;
if (MonthDay > 313 && MonthDay < 2603) TokyoStart -= 100;
if (MonthDay > 313 && MonthDay < 1106) LondonStart -= 100;
if (MonthDay > 1030 && MonthDay < 1106) LondonStart += 100;
Thanks redratsal,
Unfortunately it does not help. Gomi speaks about figuring the difference for current time from local time to exchange time and I need the difference from other (not local) time.
Baruch
p.s.
Its the second time that I ask a question on this forum. Can anyone help?
p.s.s
The first question was more like a suction to help if get helped, and I got no response.
Why are you using in variables instead of DateTime variables ?
You want to manipulate "the opening times of all exchanges", so it will be much easier to manipulate DateTime than int, as you have all the needed classes and methods to play with timezones.
See TimeZoneInfo class, ConvertTime, DateTimeOffset, ...
You know in which timezone are NY, Tokyo, ..., so you're also able to convert any date from a timezone to another one. And as these classes are "DST aware", I don't see where could be the problem to do what you want to do.
(1) This table does not take into account the different daylight saving schedules, so for Europe it will not work from March 13 to March 27, 2011 and from October 30 to November 6, 2011. Tokyo does not have any DST, so the schedule will run into problems during the summer. To display the times correctly, you would need 4 different schedules.
(2) To display the Tokyo open, you would need to introduce a column with Tokyo time, as it does not match any of the other timezones and does not use DST.
Opening hours of FOREX markets
I have visited about 20 websites for FOREX opening hours and this is the result:
Tokyo Open 6:00 PM EST in winter, 7:00 PM EST in summer
Tokyo Close 4:00 AM EST in summer 5:00 AM EST in summer
Frankfurt Open 2:00 AM EST
Frankfurt Close 11:00 AM EST
London Open 3:00 AM EST (except for the 3 weeks listed above)
London Close 12:00 PM EST (except for the 3 weeks listed above)
New York Open 8:00 AM EST
New York Close 5:00 PM EST
If I translate from your PDF: Euro Open => Frankfurt Open, London Activity => London Open, European Close => London Close, we get the same values for Europe.
I get a different value for New York (1 hour later), I only have found 4:00 PM as the New York close occasionally.
For Tokyo there are different hours for winter and summer, your opening hours at 8:00 PM are later than both the winter and summer times that I have found.
The conversion from different timezones does not work for .Net 2.0 / NinjaTrader 6.5. However, .Net 3.5 / NinjaTrader 7.0 are capable of doing the conversion. the session manager of Ninjatrader 7.0 uses this timezone conversion capability.
These are the steps to convert between different timezones:
(1) Define TimeZoneInfo variables which contain the timezoneinfo information. Here is an example to create a timezoneinfo variable for the Asian session (Tokyo time)
(2) Next use the TimeZoneInfo variables for conversion. Let us assume that you have defined four variables tstZone, cetZone, gmtZone, estZone and that they contain the correct information collected from the class library. Now you also need your local timezone and the timezone of your session template:
Local timezone can be found as: TimeZoneInfo.Local
Session template timezone can be found as: Bars.Session.TimeZoneInfo
(3) To convert, use TimeZoneInfo.ConvertTime
For example to convert from TST to local Time ->
Or to convert from session template to local time ->
You can now easily code an indicator that prints the market hours on your chart.
Here you can find an example, how to apply this. The chart shows today's FOREX sessions:
Session template (in Eastern Time): 3 sessions, Asian, European and US session. The Asian session includes Sydney and Tokio. The European session starts at 2:00 AM Est, which is correct for 49 weeks out of 52 weeks per year. The US session starts at 8:00 AM EST, the Asian session starts at 5:00 PM Est.
European open and London open is collected from the session template. The Tokyo open is generated via indicator, as the session template does only use EST, and is not aware of TST.
The opening range indicator uses TST for the Asian pre-session and CET for the European pre-session.
Created by applying the indicator twice to display both European and US opening range. The indicator is available here:
Exported using NT Version 7.0.1000.26
The indicator will only run on NT 7.0.1000.5 or later
Discretionary traders: Please use the multi-timeframe version of the indicator for odd minute charts and charts built from ticks.
https://www.bigmik …
Interestingly I saw the source code for trading platform that did a similar thing, and it was billed as a performance enhancement (math on ints being less expensive than math on DateTimes, I guess), but I wonder if it merely code that originated back during .NET 2.0. Interesting factoid, Fat Tails. Thanks.