How to reference Session template Price/Time? - NinjaTrader Programming | futures io social day trading
futures io futures trading


How to reference Session template Price/Time?
Updated: Views / Replies:3,247 / 8
Created: by forrestang Attachments:3

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

How to reference Session template Price/Time?

  #1 (permalink)
Urban Samurai
Chicago IL
 
Futures Experience: Intermediate
Platform: Ninja, MT4,TOS, SC, Matlab
Broker/Data: CQG, AMP, MB, DTN
Favorite Futures: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,039 since Jun 2010
Thanks: 226 given, 688 received

How to reference Session template Price/Time?

Simple question.

Say you where using a ETH session template for ES, as you main look of your chart. And then you decide you want to be able to reference the Open/Close price/time of "CME Index Futures RTH" template. How and when do you reference it?

Reference Link

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #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



forrestang View Post
Simple question.

Say you where using a ETH session template for ES, as you main look of your chart. And then you decide you want to be able to reference the Open/Close price/time of "CME Index Futures RTH" template. How and when do you reference it?

Reference Link

You can only reference something that is there. That means that if you want to reference the opening time of the RTH session, then you need to use a session template, which actually includes that time.

I use a session template with two sessions per day, as is attached.

To reference the session start time and the session end time of the current session you can use

 
Code
Bars.Session.GetNextBeginEnd(Bars, 0, out sessionBegin, out sessionEnd);
Now, if you have several sessions per day, you will need to find out whether your current session is the night session or the day session.

There is another NinjaScript method that may help you:

 
Code
Bars.GetTradingDayFromLocal(Time[0])
If this value increase by one day, if you detect a FirstBarOfSession event, then it is the start of the night session. If it does not increase, it is the start of the RTH session. You can then collect the session start time and use it for whatever you need to know.

As a coding example you can have a look at the OpeningRange indicator which uses these NinjaScript methods.

Attached Thumbnails
How to reference Session template Price/Time?-session-template-es.png  
Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #4 (permalink)
Urban Samurai
Chicago IL
 
Futures Experience: Intermediate
Platform: Ninja, MT4,TOS, SC, Matlab
Broker/Data: CQG, AMP, MB, DTN
Favorite Futures: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,039 since Jun 2010
Thanks: 226 given, 688 received

If you have a template with two sessions added into it, how do you reference specifically one and not the other?

I.e. when you use "Bars.Session.GetNextBeginEnd(Bars, 0, out sessionBegin, out sessionEnd);"...... how does it know which template for each day you are trying to point it to?

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


forrestang View Post
If you have a template with two sessions added into it, how do you reference specifically one and not the other?

I.e. when you use "Bars.Session.GetNextBeginEnd(Bars, 0, out sessionBegin, out sessionEnd);"...... how does it know which template for each day you are trying to point it to?

This can only be done indirectly. I keep track of the current trading day and then count the sessions. First I check, whether the current trading day changed when a Bars.FirstBarOfSession event occurs. If this is the case, then I label this session as session number 1 and store the session start time and session end time. Then I count the sessions until the next trading day starts.

It is not possible to access the session start and end times of the different sessions directly. The only way to do it is to use Bars.Session.GetNextBeginEnd(Bars, 0, out sessionBegin, out sessionEnd) and store those values along with the intradays session count, if you want to retrieve them later.

Reply With Quote
 
  #6 (permalink)
Urban Samurai
Chicago IL
 
Futures Experience: Intermediate
Platform: Ninja, MT4,TOS, SC, Matlab
Broker/Data: CQG, AMP, MB, DTN
Favorite Futures: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,039 since Jun 2010
Thanks: 226 given, 688 received

So..... since you can't actually reference an individual session template on a chart.......

Do you just create a template that has all the hours you need, i.e. a 24 hour chart, then just start counters at each session change by comparing it to a time?

see pic for example of what I mean.

Attached Thumbnails
How to reference Session template Price/Time?-11-13-2011-11-11-07-am.png  
Reply With Quote
 
  #7 (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


forrestang View Post
So..... since you can't actually reference an individual session template on a chart.......

Do you just create a template that has all the hours you need, i.e. a 24 hour chart, then just start counters at each session change by comparing it to a time?

see pic for example of what I mean.

Attached is my session template for FOREX. It has three distinct sessions per day, so every trading day there are three bars for which Bars.FirstBarOfSession returns the value "true". The enitre trading day covers three sessions. NinjaTrader will decide on its own, which of the three sessions starts the trading day. This is a weakness of the product and needs reengineering. The user should decide upon the first session of the day. The heuristics used by NinjaTrader works in 95% of all cases, but not always. In some cases it is impossible to set up the session template that you want.

I just use a counter. When the trading day starts - detected by GetTradingDayFromLocal() - I set the counter to 1.
When the second session of the trading day starts - detected by Bars.FirstBarOfSession - I set the counter to 2, for the third session of the trading day, I set it to 3. This is not difficult to do and the counter will always tell you which is your current trading session.

So I do not need to compare the time of the bar with the opening time of London or New York. I just us Bars.FirstBarOfSession as a trigger to count the intraday sessions.

You can have a look at the SessionPivots indicators - easiest would be anaCurrentDayOHL - to understand how I use it.

Attached Thumbnails
How to reference Session template Price/Time?-session-template-forex.png  
Reply With Quote
 
  #8 (permalink)
Urban Samurai
Chicago IL
 
Futures Experience: Intermediate
Platform: Ninja, MT4,TOS, SC, Matlab
Broker/Data: CQG, AMP, MB, DTN
Favorite Futures: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,039 since Jun 2010
Thanks: 226 given, 688 received


Fat Tails View Post
............ - easiest would be anaCurrentDayOHL - to understand how I use it.

Do you mean THIS one?

Reply With Quote
 
  #9 (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


forrestang View Post
Do you mean THIS one?

Yes, that would be the simplest indicator which differeniates between ETH and RTH sessions.

You can have a look at

line 262 -> checks for a new trading day (calls a subroutine which uses GetTradingDayFromLocal())
line 271 -> sessionCount is set to 1 for the first session
line 307 -> sessionCount is increased by 1

Reply With Quote
The following user says Thank You to Fat Tails for this post:

Reply



futures io > > > > > How to reference Session template Price/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
tf session template in NT? madLyfe NinjaTrader 44 February 22nd, 2012 09:37 AM
Correct Session Template for 6B in NT7 skyfly NinjaTrader 6 May 24th, 2011 04:20 PM
Defining the range where the bulk of the session's price action could take place trendisyourfriend The Elite Circle 2 September 15th, 2010 01:19 PM
Does anyone now how to modify Session Time in NT7? benharrell Traders Hideout 4 July 15th, 2010 08:25 PM
Prevent strategy from executing trade at the same price level within a session suprsnipes NinjaTrader Programming 1 February 28th, 2010 11:40 PM


All times are GMT -4. The time now is 06:16 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-15 in 0.12 seconds with 20 queries on phoenix via your IP 107.20.115.174