Stock Exchange Session / Time Color Indicator - NinjaTrader | futures io social day trading
futures io futures trading


Stock Exchange Session / Time Color Indicator
Updated: Views / Replies:4,903 / 10
Created: by drunkcolonel Attachments:17

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
 17  
 
Thread Tools Search this Thread
 

Stock Exchange Session / Time Color Indicator

  #1 (permalink)
Elite Member
Orlando FL
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: ES 6E
 
drunkcolonel's Avatar
 
Posts: 21 since Jul 2011
Thanks: 104 given, 10 received

Stock Exchange Session / Time Color Indicator

Howdy folks,
I've been trying to figure out the best way to go about something, and I'd really appreciate some help.

A little background: I've been looking at the 6E, and one thing I believe is a good idea is to take a look at how the European session went. I *think* the London Stock Exchange is the biggest one to look at, so it occurred to me I should try and see what happened with the Euro from 3:00 am to 11:30 - the hours LSE is open. (I'm in the Eastern Standard Time zone) As you can see, the first picture is what I was hoping to find. Essentially, an indicator that you could put the specified stock exchange opening and closing times in, and the indicator would plot them.

I did come across the ColorTimesRegionsNT7.cs indicator, as you can see from picture two. However it seems to have some problems plotting, as it doesn't quite line up with the times I inputed. Also there isn't a way to make it semi transparent, so as you can see, the New York sesson just colors over what is remaining of the London session. I was hoping that with a semi transparent setting... it would be easy to see where the stock exchange sessions overlapped.

I'm new to sessions, but have been trying to read more on them. I don't know if this is the best way to go about such things, but its where I've started. So I suppose my questions are:

Is what I'm doing / trying to do stupid? Or am I going about this wrong? Or... if not...

Does anyone know whether or not there is an indicator out there that closely resembles the first picture? Or alternatively...

If the indicator does not exist, could someone give me a very brief synopsis on how they would start to code it? I don't need a walk through, but a point in the right direction would be awesome. (I have some C# programming experience but I've never coded to the ninja platform. )

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

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

Reply With Quote
 
  #2 (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,601 received
Forum Reputation: Legendary


drunkcolonel View Post
Howdy folks,
I've been trying to figure out the best way to go about something, and I'd really appreciate some help.

A little background: I've been looking at the 6E, and one thing I believe is a good idea is to take a look at how the European session went. I *think* the London Stock Exchange is the biggest one to look at, so it occurred to me I should try and see what happened with the Euro from 3:00 am to 11:30 - the hours LSE is open. (I'm in the Eastern Standard Time zone) As you can see, the first picture is what I was hoping to find. Essentially, an indicator that you could put the specified stock exchange opening and closing times in, and the indicator would plot them.

I did come across the ColorTimesRegionsNT7.cs indicator, as you can see from picture two. However it seems to have some problems plotting, as it doesn't quite line up with the times I inputed. Also there isn't a way to make it semi transparent, so as you can see, the New York sesson just colors over what is remaining of the London session. I was hoping that with a semi transparent setting... it would be easy to see where the stock exchange sessions overlapped.

I'm new to sessions, but have been trying to read more on them. I don't know if this is the best way to go about such things, but its where I've started. So I suppose my questions are:

Is what I'm doing / trying to do stupid? Or am I going about this wrong? Or... if not...

Does anyone know whether or not there is an indicator out there that closely resembles the first picture? Or alternatively...

If the indicator does not exist, could someone give me a very brief synopsis on how they would start to code it? I don't need a walk through, but a point in the right direction would be awesome. (I have some C# programming experience but I've never coded to the ninja platform. )

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

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

@drunkcolonel:

I think what you try to do makes sense. But you need to take into account that you cannot get a correct zone for the London market, if you enter it in US time. This is bound fail, because the US and the UK have different daylight savings schedules. To do it correctly you would create three sessions

- Asian session to be entered in TST (Tokyo Standard Time), TST has no daylight savings schedule.
- European session to be entered in BST (British Standard Time), which is currently 1 hour ahead of Universal Time.
- US session to be entered in EST (US Eastern Time)

The indicator will then convert the times into your local time (whatever it is) and color the sessions correctly.


Determining the correct session times:

There are no fixed rules for the FOREX market, but what you can do is monitor volume. If volume moves up you may consider that the session has started.

(1) US Session: The regular trading hours for 6E start at 7:20 CT (which is 8:20 EST). But of course volume does not follow the rules for the regular session, as the underlying FOREX market is much larger. For the volume analysis you can use the intraday seasonality indicator, which is located here. The thread has a more up-to-date version...

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

An analysis of the last year of volume data will show you that trading volume increases

Mondays: after 8:00 AM EST (lower volume than for other days)
Tuesdays: after 8:00 AM EST
Wednesdays: after 8:00 AM EST
Thursdays: after 7:40 EST
Fridays: after 8:00 AM EST

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



You may now safely assume that a session start at 8:00 AM EST is correct for the US session. A similar analysis will show you that trading volume drops significantly after 11:30 AM EST. This is because the London counterparts of the US traders stop working, and they can now only deal among themselves. There is a second drop in liquidity around 3:00 PM EST. After 3:00 PM the market is already asleep. The US market closes at 5:00 PM EST.

(2) European Session: Frankfurt opens at 7:00 AM GMT, London basically one hour later. This is reflected by trade volume. The volume steps up a little bit around 7:00 AM GMT and then doubles after 8:00 AM. However, if you do a range analysis, you will find that the Euro already moves starting from 7:00 AM GMT. There is no rule here, you can either set the European session start at 7:00 AM GMT or 8:00 AM GMT. I prefer to use 7:00 AM as volatility is more important than volume. In the early afternoon New York kicks in, the end of the European session is about 4:30 PM GMT (hour at which the European stock markets close).

But don't use EST for the London session!

(3) Asian session: Tokyo business hours would be from 9:00 AM to 5:00 PM.


Coding the indicator

Use TimeSpan variables to hold the session start and end times. Use TimeZoneInfo to collect TST, GMT and EST. Convert start and end times to local time zone. Then check for each bar in whether it is included
with one of the sessions and select background color accordingly. That is about all you need to do.

Once finished, you can enter the selected hours into your indicator and then display them on your FOREX chart - see below.


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


Last edited by Fat Tails; September 13th, 2012 at 02:43 PM.
Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #3 (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,601 received
Forum Reputation: Legendary

Blending RGB colors


I forgot to mention a little detail. I was not exactly sure how to blend RGB colors. Something I did the first time today.

This procedure seems to work:

-> select a color for region 1, collect A, R, G, B values from that color
-> select a color for region 2, collect A, R, G, B values from that color
-> calculate arithmetic mean for each of the two A, R, G and B values and round it to integer
-> create new color from the arithmetic mean

At least the result seems to be a color, see overlap regions in chart above.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #4 (permalink)
Elite Member
Orlando FL
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: ES 6E
 
drunkcolonel's Avatar
 
Posts: 21 since Jul 2011
Thanks: 104 given, 10 received

Harry,

Your knowledge and generosity never ceases to amaze me sir. It's a lot for my brain to process at the moment, but I'm going to give it the 'old college try' and see what I can create! This will be a good exercise for me in understanding sessions / market times, as well as getting my feet wet programming for ninja trader. I'll only pester you again if I get really stuck.

Thanks so much for just being an awesome person.

Curt.

Reply With Quote
 
  #5 (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,601 received
Forum Reputation: Legendary


drunkcolonel View Post
Harry,

Your knowledge and generosity never ceases to amaze me sir. It's a lot for my brain to process at the moment, but I'm going to give it the 'old college try' and see what I can create! This will be a good exercise for me in understanding sessions / market times, as well as getting my feet wet programming for ninja trader. I'll only pester you again if I get really stuck.

Thanks so much for just being an awesome person.

Curt.

@drunkcolonel: Thank you for your friendly words.


Here are some more hints, how to do the coding:


(1) First declare timespan objects to hold the start and end times of the sessions.


(2) Determine the date of the FOREX session. To determine that date you will need to
-> collect the end of the current session via Bars.Session.GetNextBeginEnd()
-> convert that session end time from local to eastern time

 
Code
sessionDate = TimeZoneInfo.ConvertTime(sessionEndTimeLocal,TimeZoneInfo.Local, newyorkZone).Date;


(3) Decide on the local timezones you want to use for each of the three sessions:

.Net/C# allows you to find a time zone by name. For a timezone you would need to declare a TimeZoneInfo variable, for example

 
Code
TimeZoneInfo  tokyoZone = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time");
TimeZoneInfo londonZone = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time");
TimeZoneInfo newyorkZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");


(4) Once you have the session date and the timezones, you can convert the Tokyo, London and NewYork times to your local timezone, for example to calculate the start time for the Tokyo session you would

-> add the TimeSpan value that holds the Tokyo start time to the session date
-> then convert that time from Tokyo time to your local time

 
Code
tokyoStartTimeLocal = TimeZoneInfo.ConvertTime(sessionDate + tokyoStartTime, tstZone, TimeZoneInfo.Local);


Once you have converted all three session start times and end times into your local times, it is easy to check whether the current bar is inside one of the sessions and then color the background accordingly.

This would be the basic idea how to code that indicator.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #6 (permalink)
Elite Member
Orlando FL
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: ES 6E
 
drunkcolonel's Avatar
 
Posts: 21 since Jul 2011
Thanks: 104 given, 10 received

Understanding Time in NinjaTrader

Hi Harry,

First attempt at using MENTION and my "preview post" option was not showing your handle. So I got your userid from view source. I'm sure there is a php script that was probably supposed to do this for me. But when I preview post, at least now I get a "@Fat Tails" link with your handle. I need to probably lay off the wine.

@Fat Tails

Just incase I've "outsmarted" the Mention I'm gonna do this... and see if it shows... sorry I don't know how to use all the rich text stuff yet. Thanks for your patience.

@Fat Tails

Anyways, I had a question or two if you have the time.

( Also if anyone else out there is reading my post feel free to participate in the discussion )

First, I want to say that I ran off with your code bits and started programming the indicator. Before I knew it I found myself borrowing code from here and there as well. Soon I felt like I was creating spagettii code. I get that uneasy feeling when I write code not understanding exactly what it is doing. So then I desided to take a step back and try and focus on one core Ninjatrader programming concept at a time. I'm hoping that by putting together a few "Hello World" projects, I can atain a true understanding of the inner workings of the platform, versus just slapping down any code just to get the indicator to... ahem "work".

My first "Hello World" project is below.

I wanted to keep things extremely simple, so I've desided not to worry about sessions, daylight savings, or anything of that sort until later. For now, with my first foray into ninjatrader coding, I just wanted to focus on understanding one concept: Time. I am afraid this simple program might bore the hell out of you but I think it's one of the building blocks that is important for me to get under my belt before I advance further. If you have a spare moment, and want to take a look at it ( or if anyone else interested wants to as well ), I've done my best to make it very easy by including a simple chart template, and keeping the indicator code highly organized, commented, and clean. I've also included some screenshots as well as the associated output files. Print statements are my friend

Attached Are:

1. File: a_dev001_HourlyLines.zip Description: This zip contains the template file a_dev001_HourlyLines.xml which helps keep the chart as "bare" as possible, so that it is much easier for me to see the visuals of the indicator. It also contains a_dev001_HourlyLines.cs the actual indicator that paints a vertical line every hour on the hour as well as the corresponding start and end bars.

2. File: FigureOne.png Description: This file shows how the indicator displays on a one minute chart.

3. File: FigureTwo.png Description: This file shows how the indicator displays (or rather not) on a four range chart.

4. File: outputTime.txt Description: This text file shows an example of the output I got when using a one minute chart.

5. File: outputRange.txt Description: This text file shows an example of the output I got when using a four range chart.


Experiment Assumptions:

1. By focusing purely on Time (meaning no exchange openings/closings/holidays/settlement times) I should select the "Default 24/7" session template.

2. This means also I need an instrument that trades around the clock as well, which I believe Forex comes closest to that, so I downloaded data for $EURUSD.

3. To explore Time...I would start with NinjaTrader Time based charts, so I went with the simple one minute chart.

Experiment Results:

The results were pretty much as expected. I was happy to see the indicator printing the relevant well formatted output data, and see the lines and bars painting as they should on the one minute chart. To play around a bit and throw a wildcard in the mix, I desided to see what the indicator would do on a Range chart (where bars are plotted according to price movement, not time). I noticed nothing painted, and just got the 'basic' output data (CurrentBar and Time). But thinking about it, and looking at my output files, it made sence. The TimeSeries associated with each Range Bar does not have any DateTime which matches my "If" statements. So this made me wonder... is Time treated on the charts just as a "function" of the Bar/Data Series? This thought kind of annoyed me. My next thought was: is there no "Global" Time object that can be worked with in NinjaTrader -independent of when a bar might print?

My answer was... even if there was... how would the charts draw? It seems NinjaTrader drawing is based off of DataSeries or TimeSeries indexes. Without that reference, Ninja has no idea where to draw on the chart.

For example, when looking at the output on a 4 Range chart no bar prints exactly at 10AM. So the nearest approximation one can get to 10AM would be bar 162, and one might try do some creative coding to put the so called "hourly" line break here.

162 - 8/6/2012 9:59:10 AM
163 - 8/6/2012 10:02:31 AM


This scenario made my mind itch. It's probably my OCD kicking in.

The only solution I came up with was to add another DataSeries ( i.e. an evenly spaced linear time such as a one minute) to the chart, and have the HourlyLines indicator plot off of the Time series versus the Range series. This idea came directly from playing with your VisualEMA multi-timeframe indicator. I remember using it on a Range chart and having it plot against a 15 minute period and going "whoh"

I plan on looking around futures.io (formerly BMT) for ideas on how to program with multiple data series, as well as digging through whatever can be found in the NinjaTraders documentation. If you or anyone knows of any tutorials or threads on how to program a "hello world" multi series indi like I'm attempting, please let me know incase I miss it in my searches! I will also take any sage wisdom on the matter as well.

If anything I've said is incorrect I very much welcome corrections!!!

Vielen Dank,

Curt.

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

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

Attached Files
Register to download File Type: zip a_dev001_HourlyLines.zip (7.2 KB, 42 views)
Register to download File Type: txt outputTime.txt (61.7 KB, 19 views)
Register to download File Type: txt outputRange.txt (8.1 KB, 8 views)
Reply With Quote
 
  #7 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,353 given, 83,234 received


drunkcolonel View Post
Hi Harry,

First attempt at using MENTION and my "preview post" option was not showing your handle. So I got your userid from view source. I'm sure there is a php script that was probably supposed to do this for me

Simply type the @ symbol followed by the username. That's it. @Big Mike, @drunkcolonel. Nothing more. Nothing special.

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:
 
  #8 (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,601 received
Forum Reputation: Legendary


drunkcolonel View Post
Hi Harry,

First attempt at using MENTION and my "preview post" option was not showing your handle. So I got your userid from view source. I'm sure there is a php script that was probably supposed to do this for me. But when I preview post, at least now I get a "@Fat Tails" link with your handle. I need to probably lay off the wine.

@Fat Tails

Just incase I've "outsmarted" the Mention I'm gonna do this... and see if it shows... sorry I don't know how to use all the rich text stuff yet. Thanks for your patience.

@Fat Tails

Anyways, I had a question or two if you have the time.

( Also if anyone else out there is reading my post feel free to participate in the discussion )

First, I want to say that I ran off with your code bits and started programming the indicator. Before I knew it I found myself borrowing code from here and there as well. Soon I felt like I was creating spagettii code. I get that uneasy feeling when I write code not understanding exactly what it is doing. So then I desided to take a step back and try and focus on one core Ninjatrader programming concept at a time. I'm hoping that by putting together a few "Hello World" projects, I can atain a true understanding of the inner workings of the platform, versus just slapping down any code just to get the indicator to... ahem "work".

My first "Hello World" project is below.

I wanted to keep things extremely simple, so I've desided not to worry about sessions, daylight savings, or anything of that sort until later. For now, with my first foray into ninjatrader coding, I just wanted to focus on understanding one concept: Time. I am afraid this simple program might bore the hell out of you but I think it's one of the building blocks that is important for me to get under my belt before I advance further. If you have a spare moment, and want to take a look at it ( or if anyone else interested wants to as well ), I've done my best to make it very easy by including a simple chart template, and keeping the indicator code highly organized, commented, and clean. I've also included some screenshots as well as the associated output files. Print statements are my friend

Attached Are:

1. File: a_dev001_HourlyLines.zip Description: This zip contains the template file a_dev001_HourlyLines.xml which helps keep the chart as "bare" as possible, so that it is much easier for me to see the visuals of the indicator. It also contains a_dev001_HourlyLines.cs the actual indicator that paints a vertical line every hour on the hour as well as the corresponding start and end bars.

2. File: FigureOne.png Description: This file shows how the indicator displays on a one minute chart.

3. File: FigureTwo.png Description: This file shows how the indicator displays (or rather not) on a four range chart.

4. File: outputTime.txt Description: This text file shows an example of the output I got when using a one minute chart.

5. File: outputRange.txt Description: This text file shows an example of the output I got when using a four range chart.


Experiment Assumptions:

1. By focusing purely on Time (meaning no exchange openings/closings/holidays/settlement times) I should select the "Default 24/7" session template.

2. This means also I need an instrument that trades around the clock as well, which I believe Forex comes closest to that, so I downloaded data for $EURUSD.

3. To explore Time...I would start with NinjaTrader Time based charts, so I went with the simple one minute chart.

Experiment Results:

The results were pretty much as expected. I was happy to see the indicator printing the relevant well formatted output data, and see the lines and bars painting as they should on the one minute chart. To play around a bit and throw a wildcard in the mix, I desided to see what the indicator would do on a Range chart (where bars are plotted according to price movement, not time). I noticed nothing painted, and just got the 'basic' output data (CurrentBar and Time). But thinking about it, and looking at my output files, it made sence. The TimeSeries associated with each Range Bar does not have any DateTime which matches my "If" statements. So this made me wonder... is Time treated on the charts just as a "function" of the Bar/Data Series? This thought kind of annoyed me. My next thought was: is there no "Global" Time object that can be worked with in NinjaTrader -independent of when a bar might print?

My answer was... even if there was... how would the charts draw? It seems NinjaTrader drawing is based off of DataSeries or TimeSeries indexes. Without that reference, Ninja has no idea where to draw on the chart.

For example, when looking at the output on a 4 Range chart no bar prints exactly at 10AM. So the nearest approximation one can get to 10AM would be bar 162, and one might try do some creative coding to put the so called "hourly" line break here.

162 - 8/6/2012 9:59:10 AM
163 - 8/6/2012 10:02:31 AM


This scenario made my mind itch. It's probably my OCD kicking in.

The only solution I came up with was to add another DataSeries ( i.e. an evenly spaced linear time such as a one minute) to the chart, and have the HourlyLines indicator plot off of the Time series versus the Range series. This idea came directly from playing with your VisualEMA multi-timeframe indicator. I remember using it on a Range chart and having it plot against a 15 minute period and going "whoh"

I plan on looking around futures.io (formerly BMT) for ideas on how to program with multiple data series, as well as digging through whatever can be found in the NinjaTraders documentation. If you or anyone knows of any tutorials or threads on how to program a "hello world" multi series indi like I'm attempting, please let me know incase I miss it in my searches! I will also take any sage wisdom on the matter as well.

If anything I've said is incorrect I very much welcome corrections!!!

Vielen Dank,

Curt.

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

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

Hi Curt,

your project is a reasonable start. I have quickly applied your indicator to a chart.

-> it works fine on a 5 minute chart
-> it has holes on a 30 minute chart (not good)
-> it plots nothing on a 60 minute chart (no problem)

The 30 min chart is attached. I use a different session template, and the indicator does not like the session template.


This is the problem: If you do it correctly, you would use a session template that reflects the trading hours of the instrument per contract specifications. For example for 6E the regular session starts at 8:20 AM CT.

Time based bars: NinjaTrader aligns the bars to the session start. That means that a 30 minute chart will have bars with time stamps at 8:50, 9:20, 9:50. Your indicator draws an hourly break line, when the time stamp of a bar is identical wiht 10:00, hence your indicator does not draw any line.

Tick based chart: There will be timestamps maybe at 9:59:37 and the next one at 10:01:12, etc. Your indicator only will draw a line, if the time stamp of the tick bar happens to match 10:00 exactly.

Your approach is no solution, the logic should be like this: If the timestamp of the current bar is greater or equal than 10:00 AM and if the timestamp of the previous bar is smaller than 10:00 AM then draw an hourly line at 10:00 AM. That way you will draw the hourly lines that are not matched by a timestamp of a bar.

You should also try to reduce the code within OnBarUpdate() from 800 to 15 lines.


One important detail:

If you have a session break at 8:30 AM CT (start of the regular session for ES)

-> the minute bar with a timestamp of 8:30:00 belongs to the prior session
-> a tick-built bar with a timestamp of 8:30:00 belongs to the new sessions and represents price action after the session break

The problem is that the granularity of NinjaTrader timestamps is 1 seconds, and as you approach subsecond timestamps, they are truncated. The real-time stamp of that minute bar is indeed 8:30:00 AM and it closes the prior session. However the real time stamp of the tick-built bar may have been 8:30:00:012 (8 hours, 30 minutes, 0 second and 12 milliseconds) and it is being truncated to 8:30:00. The last tick-built bar of the prior session is truncated to 8:29:59.

Just to let you know.


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


Last edited by Fat Tails; September 28th, 2012 at 04:33 AM.
Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #9 (permalink)
Elite Member
Orlando FL
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: ES 6E
 
drunkcolonel's Avatar
 
Posts: 21 since Jul 2011
Thanks: 104 given, 10 received

Understanding Sessions


Fat Tails View Post
This is the problem: If you do it correctly, you would use a session template that reflects the trading hours of the instrument per contract specifications. For example for 6E the regular session starts at 8:20 AM CT.

Hi Harry,

I was wondering if you meant 8:20 Eastern Time? Per my SessonManager.png it says 7:20 and I think it is talking about Central Time... though it does not specify... and I would be an hour "earlier" which for me would be 8:20.

I think the light finally came on inside my head, thanks to your comments. I think sessions are what a lot of traders starting out like me probably get confused on. Even after a lot of reading and watching your webinar. Though I was just trying to simplify one concept at the time -in terms of understanding the inner workings of NT with respect to beginning level programming and how it 'processed time', I can now see how you can't just look at Time in a vacuum regarding trading.

To help any other person out there in the future, I wanted to try and explain my Aha! or more like (Duh!) moment. I find myself reading posts years old, so I know people are going to come across this one day, so hopefully I can save them some time.

One thing I've been working towards is a longer term simulation run / manual backtest of my trading plan. I wanted to see if some setups seemed to work better during certain times. ( Which was why I was trying to easily visually identify when other Exchanges were open with other traders active ) I figured I would keep track of this data, essentially noting when setups frequently occurred e.g.. the 1sts of the month... or various hourly windows such as 9:30-10:30AMs... etc..."

If everything in this business, at least according to Linda Raschke "is a mathematical probability", then it follows that keeping track of when setups materialized, and thier favorable or unfavorable results would be a good idea. The point was to have some statistics to back up the edge I've been trying to develop.

Well the duh moment occurred when I was looking at the Calendar Months July and August. I began thinking about how I would start to do such a longer term back test... (all the while thinking of what you said... figuring there was a gap in my knowledge somewhere). Then I realized looking at July 1st and August 1st... did I really want to compare a Sundays trading action with a Tuesdays? Does that make any sense? Would that not be like comparing an Apple and Orange? I began to think that my initial thinking did not make sense. Then I opened Ninja Traders Session Manger, selected CME FX Futures ETH (I'm working on the 6E), and it showed the contract trading times in terms of Sunday, Monday, Tues, etc... That is, it wasn't about "how well would the set-up historically perform on the 9th or 29th", but rather, how does the set-up tend to do on the Monday or Tuesday...

NOTE: Calendar.png essentially captures what I started realizing with the duh moment.

NOTE: I've attached a picture of the Session Manager with both the Regular Trading Hours and Extended Trading Hours, hopefully it will help some new guy like me one day.

So to explore session templates further, I started by creating 2 basic 10 minute charts. The first one with a session template field set to "Use Instrument Settings", and the second set to "CME Futures FX ETH". I wanted to see is the data displayed on the two charts the same between this default setting and my manual setting. The answer it seems is Yes, Ninja seems to have an automatic way of figuring out an appropriate template for the instrument. After this I closed one chart down, and proceeded to markup the other with the information from Session Manager.

NOTE: DataSeries.png shows what I was talking about with the previous paragraph

In marking up the chart, I ended up with two questions:

1. Where the red circle encloses the question marks: I couldn't figure out what this "break / time span" was. Obviously trading was still occurring... but what is the significance of it not being a part of the Extended Trading Hours template?

2. Where the red circle encloses the box: I couldn't figure out why Time jumped from 17:00 hours to 18:00 hours and what significance this represents with regard to the session template.

NOTE: ChartMarkup.png has the picture with the various markup.

I tried looking back on the CME information page to try and figure it out, I'm sure I'm missing something obvious to others. The only thing I can see is its the ClearPort break? What is that?

Lastly upon trying to digest all this information... I began asking myself some questions on what makes sense to use. Specifically:

1. Are Extended Trading Hour session templates best for what I want to do?

I wanted to be able to trade other Exchanges, knowing that liquidity/volume/participation is coming into the market around certain hours. However if we take the London Stock Exchange as an example, are those blokes looking at an Extended Trading Hours session template? Or are the professional traders mostly paying attention to their (London Stock Exchange time zone adjusted) "Regular Trading Hours" session templates? Which lead to my last question:

2. Would it be better to use separate session templates based off what exchange is currently experiencing the most liquidity? That is: have two session templates: One for London... and trade with it accordingly -seeing what the folks across the pond "see", and another for New York... as liquidity from NY starts taking over... switch to what the New York professionals "see"... ?

My thoughts are just as New York has its "opening range" Highs Lows VWAP and such... would not the London guys be looking at their own opening range, lows, highs and be focused on those important price points?

God I hope this made sense and I just didn't come off a total retard, else I should scrap my dreams and just get everyones address here on futures.io (formerly BMT) so I can send you my money... it would be a lot quicker. lol.

Thanks Harry for any response... I know it is a lot. Too bad you don't have a "Buy Beer" link next to your Fox... it is Oktoberfest after all.

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

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

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

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

Reply With Quote
 
  #10 (permalink)
Elite Member
Bala, PA, USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Mirus, IB
Favorite Futures: SPY, Oil, Euro
 
monpere's Avatar
 
Posts: 1,858 since Jul 2010
Thanks: 300 given, 3,276 received



drunkcolonel View Post
Howdy folks,
I've been trying to figure out the best way to go about something, and I'd really appreciate some help.

A little background: I've been looking at the 6E, and one thing I believe is a good idea is to take a look at how the European session went. I *think* the London Stock Exchange is the biggest one to look at, so it occurred to me I should try and see what happened with the Euro from 3:00 am to 11:30 - the hours LSE is open. (I'm in the Eastern Standard Time zone) As you can see, the first picture is what I was hoping to find. Essentially, an indicator that you could put the specified stock exchange opening and closing times in, and the indicator would plot them.

I did come across the ColorTimesRegionsNT7.cs indicator, as you can see from picture two. However it seems to have some problems plotting, as it doesn't quite line up with the times I inputed. Also there isn't a way to make it semi transparent, so as you can see, the New York sesson just colors over what is remaining of the London session. I was hoping that with a semi transparent setting... it would be easy to see where the stock exchange sessions overlapped.

I'm new to sessions, but have been trying to read more on them. I don't know if this is the best way to go about such things, but its where I've started. So I suppose my questions are:

Is what I'm doing / trying to do stupid? Or am I going about this wrong? Or... if not...

Does anyone know whether or not there is an indicator out there that closely resembles the first picture? Or alternatively...

If the indicator does not exist, could someone give me a very brief synopsis on how they would start to code it? I don't need a walk through, but a point in the right direction would be awesome. (I have some C# programming experience but I've never coded to the ninja platform. )

Cheers,
Curt.

Have you tried the TimeZoneColors indicator? It blends the colors in the overlapped time sessions.

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

Reply With Quote
The following 2 users say Thank You to monpere for this post:

Reply



futures io > > > > Stock Exchange Session / Time Color Indicator

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
reporting exchange time LostTrader NinjaTrader Programming 8 June 23rd, 2011 01:18 PM
Will Nasdaq Now Bid for the London Stock Exchange? Quick Summary News and Current Events 0 May 17th, 2011 03:10 AM
Local vs Exchange time Mondrakete TradeStation 2 May 8th, 2011 06:40 PM
Nasdaq Goes Hostile in Bid for New York Stock Exchange Quick Summary News and Current Events 0 May 2nd, 2011 04:10 PM
How to calculate Exchange Opening Time? baruchs NinjaTrader Programming 13 January 12th, 2011 07:08 AM


All times are GMT -4. The time now is 12:52 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-14 in 0.28 seconds with 20 queries on phoenix via your IP 54.221.93.187