NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 06-17-2012, 06:32 AM   #1
freewind
Senior Member
 
Join Date: Jan 2010
Posts: 273
Thanks: 15
Thanked 4 times in 3 posts
Default High/Low since session start

Hi,

I'm developing a multi-instrument stocks 5m intraday strategy on US session.
I want to find out for each instrument the High/Low points since the session start.
For example for stocks XYZ 2 hours from the start of the trading day(9:30EST) I want to know what was the High point and the low point.
I thought about using the Max/Min function and to give them the number of bars since the session started something like that:
Code:
max = MAX(Highs[5], BarsSinceSession)[0];
My problem is that I don't know how many bars there are for each instrument, Maybe the primary BIP has more bars since the other BIP.
What do you think is the best approach to solve this?

TX,
Roy
freewind is offline  
Reply With Quote
Old 06-17-2012, 07:06 AM   #2
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,199
Thanks: 24
Thanked 1,225 times in 996 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by freewind View Post
Hi,

I'm developing a multi-instrument stocks 5m intraday strategy on US session.
I want to find out for each instrument the High/Low points since the session start.
For example for stocks XYZ 2 hours from the start of the trading day(9:30EST) I want to know what was the High point and the low point.
I thought about using the Max/Min function and to give them the number of bars since the session started something like that:
Code:
max = MAX(Highs[5], BarsSinceSession)[0];
My problem is that I don't know how many bars there are for each instrument, Maybe the primary BIP has more bars since the other BIP.
What do you think is the best approach to solve this?

TX,
Roy
Reference specific bar series by either;
Using a BarsInProgess filter when needed: http://www.ninjatrader.com/support/h...inprogress.htm,
or by specifying the bar series with an index: http://www.ninjatrader.com/support/h...html?highs.htm
koganam is offline  
Reply With Quote
The following user says thank you to koganam for this post:
Old 06-17-2012, 07:28 AM   #3
freewind
Senior Member
 
Join Date: Jan 2010
Posts: 273
Thanks: 15
Thanked 4 times in 3 posts
Default

If I understood what you meant the BarsSinceSession is tight to the BIP the called the OnBarUpdate(), am I correct?
freewind is offline  
Reply With Quote
Old 06-17-2012, 11:14 AM   #4
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,199
Thanks: 24
Thanked 1,225 times in 996 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by freewind View Post
If I understood what you meant the BarsSinceSession is tight to the BIP the called the OnBarUpdate(), am I correct?
Not quite. You said that you want to find when each instrument in a multi-instrument ...

The BarsInProgress will filter calculations to the instrument which matches its BarsInProgress index, and exclude the other instruments.
koganam is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Resetting the Swing High/Low Indicator on New Session MJUK10 Strategy Development 23 06-08-2011 05:11 AM
Displayng chart betw session low & high Art09 Suggestions And Feedback 1 03-09-2011 09:03 AM
Display the chart betw session high & low... Art09 Charting 3 03-02-2011 12:02 PM
High and low for the session differ on range compared to minute charts suprsnipes Charting 11 03-24-2010 12:53 PM
Can 15-Minute Bar Backtest bars start on 7:20AM Session Start instead of 7:15 AM? ChiTrader2000 Strategy Development 5 01-30-2009 10:29 AM


All times are GMT -6. The time now is 03:35 AM.