Actually, how can I detect the end of a bar whether it be a "tick bar" or a time based bar? Thanks.
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
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?
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 ellington, Today, 07:40 AM
|
0 responses
1 view
0 likes
|
Last Post
by ellington
Today, 07:40 AM
|
||
Started by Atticus20, Today, 07:27 AM
|
0 responses
3 views
0 likes
|
Last Post
by Atticus20
Today, 07:27 AM
|
||
Started by ninza33, Today, 07:16 AM
|
0 responses
4 views
0 likes
|
Last Post
by ninza33
Today, 07:16 AM
|
||
Started by linkcou, Today, 07:01 AM
|
0 responses
7 views
0 likes
|
Last Post
by linkcou
Today, 07:01 AM
|
||
Started by brunoviveiros, 02-17-2020, 05:31 AM
|
4 responses
63 views
0 likes
|
Last Post Today, 06:25 AM |
Comment