Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
NT 8 Bug or Feature? Zombie Indicator
Collapse
X
-
You are correct that OnStatechange() is entered for all indicators which are compiled on the system. They do not have to be "Configured" on a chart (i.e., running).
This would happen even if the indicator was never added and configured to a chart.
Leave a comment:
-
After Removed, I only remember seeing State.SetDefaults and State.Terminated.Originally posted by NinjaTrader_Matthew View PostWhich States were you seeing printed after you removed it? In my testing, it only shows State.SetDefaults and State.Terminated.
Please expand more on what you mean by "indicator is not actually running":
Doesn't removing an Indicator from a Chart mean that it should not do anything on that Chart from then on?
Are you saying that OnStateChange() is entered for all Indicators Compiled, not just the ones Added the Chart?
Or, once Added OnStateChange() will always be called even after removed?
Leave a comment:
-
Which States were you seeing printed after you removed it? In my testing, it only shows State.SetDefaults and State.Terminated.
Similar to the Initialize() method, OnStateChange() will be called for these two States mentioned above throughout the lifetime of the applications run time, even if it is not configured on a chart. This is expected behavior.
The reason for this is the same as in NinjaTrader 7, when you open your indicators menu, there is a call to each of the indicators SetDefaults in order to generate the list of indicators you see displayed on the UI.
In NinjaTrader 8 this process will now call State.Terminated as well.
You should not see anything beyond these two states when the indicator is not actually running. But do let us know if you see otherwise and we'll be happy to look into.
Leave a comment:
-
NT 8 Bug or Feature? Zombie Indicator
I was trying to understand the onStateChange() method, so I created the simplest of NijaScripts that I called ShowState (attached). I generated the New Indicator from the Editor and added the line below to OnStateChange(). Changed nothing else.
1) Opened NinjaScript Output Window and Added my ShowState Indicator to Chart.protected override void OnStateChange()
{
Print ("ShowState: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " State Change = " + State);
if (State == State.SetDefaults)
. . .
}
2) Immediately saw messages from ShowState in Output Window.
3) After playing with various activities to watch the State Change I removed the Indicator from the Chart.
4) To my amazement the ShowState messages continued to be written to the Output Window.
5) Added ShowState back into the Chart and now the messages were doubled.
6) Removed ShowState from Chart and single messages still written to Output Window.
7) Created new Workspace named Zombie Demo
8) Saved and copied workspace when new, after Indicator added, and after all Indicators removed.
9) Restarted NT and still getting ShowState messages.
10) Only way to kill the zombie was to set ShowState as Excluded From Compilation and Compile.
Attached as Zombie message.jpg was created by:
1) Open NT
2) Open Output Window and Clear it.
3) Select Indicators...
4) Take snapshot of Indicators and Output Window.Last edited by Jim W.; 10-21-2015, 02:25 PM.Tags: None
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, Yesterday, 06:46 AM
|
0 responses
14 views
0 likes
|
Last Post
by Mindset
Yesterday, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
23 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
16 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
82 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
51 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Leave a comment: