![]() |
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
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Feb 2008
Posts: 103
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
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.
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Feb 2008
Posts: 103
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks Ben.
I think this is just what I needed. Cheers. |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
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!
Ben
NinjaTrader Customer Service |
|
|
|
![]() |
| Tags |
| time, volume |
| Thread Tools | |
| Display Modes | |
|
|
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 |