Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Highest Volume bar of the day
Collapse
X
-
Highest Volume bar of the day
I am trying to find out in my strategy if the current bar has the highest volume of the day. I have copied the CurrentDayOHL to CurrendDayVolHL to create a volume high & low volume for each bar. Its returning null. Any one has any ideasTags: None
-
Originally posted by [email protected] View PostI am trying to find out in my strategy if the current bar has the highest volume of the day. I have copied the CurrentDayOHL to CurrendDayVolHL to create a volume high & low volume for each bar. Its returning null. Any one has any ideas
You could just traverse the Volume data series looking for bars with higher volume than Volume[0].
Something like,
Code:private int ReturnHighestVolumeBar(int Lookback) { for (int indx = 0; indx < Lookback; ++indx) { if (indx < CurrentBar) if (Volume[indx] > Volume[0]) return indx; } return 0; }
-
Thank you! This make sense. Do you know of any code that uses the lookback from the start of market. Also the Volume[indx) will go back to markets beginning?
Comment
-
Hello dlespinasse50,
Thanks for writing in.
I am glad you have found additional assistance on our forums!
The barsAgo index will go back as far as the data that is given to the primary data series.
There is not a given price object or volume object that will give you the reverse order in which the price object can be referenced (starting from the beginning of the data series and ending with the last iterated bar of the data series.) If you would like to reference this data you must loop through the data in the opposite direction.
The following loop can be used as an example:
Code:for (int i = 0; i < CurrentBar-1; i++) { }
JimNinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by The_Sec, Yesterday, 03:37 PM
|
1 response
11 views
0 likes
|
Last Post Today, 06:17 AM | ||
Started by vecnopus, Today, 06:15 AM
|
0 responses
1 view
0 likes
|
Last Post
by vecnopus
Today, 06:15 AM
|
||
Started by Aviram Y, Today, 05:29 AM
|
0 responses
5 views
0 likes
|
Last Post
by Aviram Y
Today, 05:29 AM
|
||
Started by quantismo, 04-17-2024, 05:13 PM
|
3 responses
27 views
0 likes
|
Last Post Today, 05:23 AM | ||
Started by ScottWalsh, 04-16-2024, 04:29 PM
|
7 responses
36 views
0 likes
|
Last Post Today, 05:15 AM |
Comment