Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

average based on time not bars

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    average based on time not bars

    Scenario: I want to collect bar volume counts for a time back (e.g.last 2 hours) not a number of bars back. The only way I can think it might work is to process the vol data series bars in a loop until I get a bar whose bar time is less than Time [0] - 2 hours. I can't just subtract the oldest bar and add the newest as there may not be a one for one correlation or if I am using range or volume bars or the time may include a very slow period where there is not a bar for every bar period or possibly multiple bars..

    Solution: Each new bar close I will need to loop thru the Vol data series from most recent bar until I reach a low time bar or bar 0 (right to left). I have it working fine left to right but after 2 hours I have to reset the counts and start over. I don't want an accumulation of 2 hours but a rolling 2 hours plot.

    Question: Just checking to make sure there isn't a better way. The logic is simple but it will be a bit of a pig. It was the only way I could see to get the correct desired result no matter the chart time frame.

    Hope this makes sense.
    Last edited by ct; 03-23-2013, 10:01 PM.

    #2
    Originally posted by ct View Post
    Scenario: I want to collect bar volume counts for a time back (e.g.last 2 hours) not a number of bars back. The only way I can think it might work is to process the vol data series bars in a loop until I get a bar whose bar time is less than Time [0] - 2 hours. I can't just subtract the oldest bar and add the newest as there may not be a one for one correlation or if I am using range or volume bars or the time may include a very slow period where there is not a bar for every bar period or possibly multiple bars..

    Solution: Each new bar close I will need to loop thru the Vol data series from most recent bar until I reach a low time bar or bar 0 (right to left). I have it working fine left to right but after 2 hours I have to reset the counts and start over. I don't want an accumulation of 2 hours but a rolling 2 hours plot.

    Question: Just checking to make sure there isn't a better way. The logic is simple but it will be a bit of a pig. It was the only way I could see to get the correct desired result no matter the chart time frame.

    Hope this makes sense.
    Take a look at my last post in this thread. It essentially describes how to go about what you want to do.

    ref: http://www.ninjatrader.com/support/f...ion#post290792

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    176 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    331 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    253 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    356 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    183 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X