NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 02-13-2010, 11:52 AM   #1
roland_nt
Senior Member
 
Join Date: Feb 2008
Posts: 103
Thanks: 0
Thanked 0 times in 0 posts
Default reference a volume at the same time 5 days ago

I understand that volume[1] references the volume of the bar previous to CurrentBar. What subscript would I use to reference the volume of a bar that had the same hour/minute time value but exactly 4 trading days ago.
For example if the CurrentBar was occurring 10:15 AM on Tuesday for a 1 minute chart, what subscript would reference exactly the volume for the one minute bar of 10:15 AM last Wednesday (the prior week)?
Or more generally, how do I derive/detect the bar value for a specified time in the past?
Thanks to all you geniuses who will answer this.
roland_nt is offline  
Reply With Quote
Old 02-13-2010, 05:53 PM   #2
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

This link uses time references, which will help:
http://www.ninjatrader-support2.com/...ead.php?t=3226

One way to do it is:
for (int i = 0; i < my_barsback; i++)
{
if(my_time == ToTime(Time[i]))
{
my_vol = Volume[i];
break;
}
}


This is untested, so test it.
Or if you know how many bars back you don't need a loop.
NinjaTrader_Ben is offline  
Reply With Quote
Old 02-13-2010, 06:12 PM   #3
roland_nt
Senior Member
 
Join Date: Feb 2008
Posts: 103
Thanks: 0
Thanked 0 times in 0 posts
Smile good start

Thanks Ben.
I think this is just what I needed. Cheers.
roland_nt is offline  
Reply With Quote
Old 02-14-2010, 09:29 AM   #4
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

I'm not sure why I didn't go this way, but this is easier than looping:
http://www.ninjatrader-support.com/H...V6/GetBar.html

Use GetBar(). Sorry about that!
NinjaTrader_Ben is offline  
Reply With Quote
Reply

Tags
time, volume

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
Todays intraba volume plus 5 days tinkerz General Programming 6 05-23-2011 04:51 PM
Close of 20 day high 4 days ago? tjendra General Programming 1 06-22-2009 05:55 AM
Specify any time days ago binwang2 General Programming 3 01-26-2009 10:59 AM
Using PriordayOHLC to retreive 2 days ago johnroe General Programming 5 03-05-2008 01:52 PM
Dynamic base pointer or time reference for secondary time interval ct Strategy Development 11 06-20-2007 02:27 PM


All times are GMT -6. The time now is 10:00 PM.