Is there a way to modify the seconds bar type so that even if there was no volume printed at a time stamp, that zero volume still counts as as data point?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Bar index for second bar types
Collapse
X
-
Bar index for second bar types
I'd like to use the SUM indicator to give me a sum of the last 100 secs of volume. But the indicator appears to give the last 100 data points.
Is there a way to modify the seconds bar type so that even if there was no volume printed at a time stamp, that zero volume still counts as as data point?
Tags: None
-
Hello edmanta1109,
Thanks for your message.
The BarsType's OnDataPoint method would still be event based, and I would not recommend incorporating a timer for AddBar and UpdateBar to be called from the timer to create a 0 volume bars.
Instead, I would recommend adding a timer in your indicator, and then using the timer to count how much volume has passed by collecting it in OnMarketData. I have attached an example that can be used to provide further direction, however it should be noted that the timer may not be completely in sync with the time based bars since the time based bars are event based and based on incoming data. The solution provided should be enough to move forward, however.
Please let me know if I can be of further assistance.Attached Files
-
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
74 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
152 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
162 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
100 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
289 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment