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
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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 FilesJimNinjaTrader Customer Service
-
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by adeelshahzad, Today, 03:54 AM
|
4 responses
22 views
0 likes
|
Last Post
by adeelshahzad
Today, 10:51 AM
|
||
Started by merzo, 06-25-2023, 02:19 AM
|
10 responses
823 views
1 like
|
Last Post Today, 10:38 AM | ||
Started by frankthearm, Today, 09:08 AM
|
5 responses
15 views
0 likes
|
Last Post Today, 10:19 AM | ||
Started by jeronymite, 04-12-2024, 04:26 PM
|
3 responses
43 views
0 likes
|
Last Post
by jeronymite
Yesterday, 10:10 PM
|
||
Started by yertle, Today, 08:38 AM
|
5 responses
16 views
0 likes
|
Last Post Today, 09:45 AM |
Comment