Actually, how can I detect the end of a bar whether it be a "tick bar" or a time based bar? Thanks.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Easiest way to check for last tick on a tick bar?
Collapse
X
-
Easiest way to check for last tick on a tick bar?
There are some calculations that I want to update with every tick. I also want to do some additional processing on the last tick of a bar. How can I determine the last tick on a bar? Thanks.
Actually, how can I detect the end of a bar whether it be a "tick bar" or a time based bar? Thanks.Last edited by higler; 05-10-2007, 04:12 PM.Tags: None
-
For time based intervals, there is no way to know if a tick is the last tick of a bar. The reason is, you don't know a tick was the last tick until you know you have the first tick of the bar and at that time, the last tick of the prior bar has already been processed.
For a tick bar, try checking the TickCount property.RayNinjaTrader Customer Service
-
On a tick chart I just experimented with checking Bars.TickCount and have an interesting situation. I modified my indicator to to check for the last tick. I applied it to a 150 tick bar chart and I have my indicator reporting Bar.TickCount to the Data Box. All my historical bars list the TickCount at 138.0. All my bars accumulated real time list the "correct" 150.0 TickCount after the close of the bar. As a result, my indicator doesn't perform the end of bar calculations on the historical bars but does perform them on the "real time" bars. Am I missing something on getting the historical bars to report the "correct" end of bar tick count? I would like my indicator to calculate both the historical and real time bars. Thanks.
Comment
-
After looking more closely at the code and documentation, it appears that the error was on my part, naturally. In the documentation is looks like Bars.TickCount refers to the number of ticks of the CURRENT bar, so for older (historical) bars in the Data Box it was just showing what the TickCount was when I "started up" the indicator. So, if I also do a check for Historical then I can get the calculations that I want on either Historical or Real Time bars.
I couldn't find any documentation on Bars objects which would probably help me. Thanks.
Comment
-
TickCount for historical data?
I have a strategy which sets CalculateOnBarClose = false such that OnBarUpdate gets called for each tick. As described in the quote, I also get Bars.TickCount as a never changing value while processing historical data for backtesting. How do I reference TickCount within historical bars ?Originally posted by higler View PostAfter looking more closely at the code and documentation, it appears that the error was on my part, naturally. In the documentation is looks like Bars.TickCount refers to the number of ticks of the CURRENT bar, so for older (historical) bars in the Data Box it was just showing what the TickCount was when I "started up" the indicator. So, if I also do a check for Historical then I can get the calculations that I want on either Historical or Real Time bars.
I couldn't find any documentation on Bars objects which would probably help me. Thanks.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
574 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
332 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment