How to calculate Exchange Opening Time? - NinjaTrader Programming | futures io social day trading
futures io futures trading


How to calculate Exchange Opening Time?
Updated: Views / Replies:2,997 / 13
Created: by baruchs Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 1  
 
Thread Tools Search this Thread
 

How to calculate Exchange Opening Time?

  #11 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary


sam028 View Post
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.

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)

 
Code
private TimeZoneInfo tstZone // TST stands for Tokyo Standard Time
try
{
tstZone = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time"); 
}
catch (TimeZoneNotFoundException ex2)
{
throw new TimeZoneNotFoundException( String.Format("The time zone '{0}'cannot be found.", "Tokyo Standard Time"), ex);
}
(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 ->

 
Code
time = TimeZoneInfo.ConvertTime(time, tstZone, TimeZoneInfo.Local)
Or to convert from session template to local time ->

 
Code
time = TimeZoneInfo.ConvertTime(time, Bars.Session.TimeZoneInfo, TimeZoneInfo.Local)
You can now easily code an indicator that prints the market hours on your chart.

Reply With Quote
 
  #12 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary

Example:FOREX Session of Today

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:

https://futures.io/free_downloads/ninjatrader-7/indicators/620-download.html?view

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
 
  #13 (permalink)
Elite Member
Israel
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: pfg
Favorite Futures: eminis
 
Posts: 323 since Jun 2009
Thanks: 6 given, 206 received


Hi fat tails,
Thank you very much. I'll work with ETC conversion.
You are very helpful.

Baruch

Reply With Quote
 
  #14 (permalink)
Elite Member
Asia
 
Futures Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received


sam028 View Post
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.

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.

Reply With Quote

Reply



futures io > > > > > How to calculate Exchange Opening Time?

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate Developing Value Area Mauro_60 NinjaTrader Programming 8 September 24th, 2013 03:08 PM
Calculate MACD divergence scarr Traders Hideout 9 August 20th, 2011 01:15 PM
reporting exchange time LostTrader NinjaTrader Programming 8 June 23rd, 2011 01:18 PM
Local vs Exchange time Mondrakete TradeStation 2 May 8th, 2011 06:40 PM
How do we calculate MB's new forex commission structure? Dragon Reviews of Brokers and Data Feeds 7 May 8th, 2010 03:30 AM


All times are GMT -4. The time now is 02:54 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-18 in 0.11 seconds with 20 queries on phoenix via your IP 54.163.209.109