Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Correction in the Code Breaking Changes Overview
Collapse
X
-
Originally posted by NinjaTrader_Matthew View Post
-
Thanks for the feedback and discussion guys. We will review to make that point more clear.
Leave a comment:
-
Originally posted by koganam View PostConfusing I agree, until I thought of it this way. The State enum is a different and independent entity from the event handler/method OnStateChange(). We can query the State from anywhere that it is in scope, which pretty much means for all user classes, as the enum is declared way back in the NinjaScript namespace.
Leave a comment:
-
Originally posted by molecool View PostA small oversight apparently in the documentation:
NinjaTrader previously used a Historical bool property to notify when an indicator or strategy bar was being processed historically or real-time. The NinjaTrader 8 OnStateChange() method has now introduced a concept of State.Historical or State.Realtime which will allow you to take action depending on the desired state:
protected override void OnBarUpdate()
{
// only process on real-time data
if (State == State.Historical)
return;
else if (State >= State.Realtime)
// rest of logic
}
Shouldn't this say ... in the OnBarUpdate() method...?
BTW, awesome new capability - this is something I spent months finding work arounds for.
Leave a comment:
-
Originally posted by sledge View PostI at first read it that way that you are thinking - but if you look up OnStateChange - it makes more sense.
Historical was tucked away into OnStateChange(), realtime was added.
OnStateChange I suspect will be called first when historical hits, when realtime hits, etc.. You are just checking the state in OnBarUpdate that was caused by OnSTateChange.
Call me a stickler but IMHO that part of the doc should be rewritten a little to make that more clear.
Leave a comment:
-
I at first read it that way that you are thinking - but if you look up OnStateChange - it makes more sense.
Historical was tucked away into OnStateChange(), realtime was added.
OnStateChange I suspect will be called first when historical hits, when realtime hits, etc.. You are just checking the state in OnBarUpdate that was caused by OnSTateChange.
Leave a comment:
-
Correction in the Code Breaking Changes Overview
A small oversight apparently in the documentation:
NinjaTrader previously used a Historical bool property to notify when an indicator or strategy bar was being processed historically or real-time. The NinjaTrader 8 OnStateChange() method has now introduced a concept of State.Historical or State.Realtime which will allow you to take action depending on the desired state:
protected override void OnBarUpdate()
{
// only process on real-time data
if (State == State.Historical)
return;
else if (State >= State.Realtime)
// rest of logic
}
Shouldn't this say ... in the OnBarUpdate() method...?
BTW, awesome new capability - this is something I spent months finding work arounds for.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by chbruno, Today, 04:10 PM
|
0 responses
3 views
0 likes
|
Last Post
by chbruno
Today, 04:10 PM
|
||
Started by josh18955, 03-25-2023, 11:16 AM
|
6 responses
436 views
0 likes
|
Last Post
by Delerium
Today, 03:42 PM
|
||
Started by FAQtrader, Today, 03:35 PM
|
0 responses
6 views
0 likes
|
Last Post
by FAQtrader
Today, 03:35 PM
|
||
Started by rocketman7, Today, 09:41 AM
|
5 responses
19 views
0 likes
|
Last Post Today, 03:33 PM | ||
Started by frslvr, 04-11-2024, 07:26 AM
|
9 responses
127 views
1 like
|
Last Post
by caryc123
Today, 03:12 PM
|
Leave a comment: