I can find out experimentally, of course, but please include that in the documentation. I did not look, but I doubt that ChartControl is the only object missing that piece of information in its manual page.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Please document when system objects become available
Collapse
X
-
Please document when system objects become available
I just got a null reference by trying to use ChartControl from State.Configure. So I looked in the ChartControl documentation and can find nothing about when it is safe to use it. (This use is in the context of a chart window.)
I can find out experimentally, of course, but please include that in the documentation. I did not look, but I doubt that ChartControl is the only object missing that piece of information in its manual page.Tags: None
-
Hello ETFVoyageur,
Thank you for your post.
From the Help Guide at the following link: http://ninjatrader.com/support/helpG...artcontrol.htm
Use a null reference check to ensure the ChartControl is available.Note: The ChartControl object is ONLY guaranteed to be available when a NinjaScript type initiates from a Chart Window. There are situations where an indicator or strategy starts from another Windows (such as the Control Center's Strategies Grid, or from a Strategy Analyzer), where the ChartContol object is NOT accessible. Therefore, the ChartControl object should always be safely accessed (e.g., from within a try-catch, or conditionally using null reference checks)
However, Configure is not likely to have ChartControl. It would be the State DataLoaded when it would be available, but still recommended to use a null reference check. Please refer to the State documentation at the following link: http://ninjatrader.com/support/helpG...n-us/state.htm
A null reference check in OnStateChange:
I would say an understanding of states and the object you are calling would be needed no matter if the documentation is there or not. Documenting every object and when it is available will be submitted to the Product Management team.Code:else if (State == State.DataLoaded) { if (ChartControl != null) { // do something } }
-
I had read that. I was probably too focused on an indicator that is only useful for a chart, and was wondering at what point ChartControl would be guaranteed provided it is used on a chart.. As I said, I can experiment to find out.
That does bring up something else I have been meaning to ask. This "indicator" is really only useful for charts. It provides some things that are useful only for charts, and it does not generate any values. Is there any way to ensure that it does not get added to anything other than a chart?
Comment
-
Originally posted by ETFVoyageur View PostI had read that. I was probably too focused on an indicator that is only useful for a chart, and was wondering at what point ChartControl would be guaranteed provided it is used on a chart.. As I said, I can experiment to find out.
That does bring up something else I have been meaning to ask. This "indicator" is really only useful for charts. It provides some things that are useful only for charts, and it does not generate any values. Is there any way to ensure that it does not get added to anything other than a chart?Does that handle it?Code:IsChartOnly = true; //still undocumented!
NT Support: Can we get it documented, please?
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
672 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
379 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
111 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
577 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
582 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment