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 sjsj2732, Yesterday, 04:31 AM
    0 responses
    33 views
    0 likes
    Last Post sjsj2732  
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    286 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    284 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    133 views
    1 like
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    91 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Working...
    X