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
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:
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?Code:IsChartOnly = true; //still undocumented!
NT Support: Can we get it documented, please?
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by kempotrader, Today, 08:56 AM
|
0 responses
6 views
0 likes
|
Last Post
by kempotrader
Today, 08:56 AM
|
||
Started by kempotrader, Today, 08:54 AM
|
0 responses
4 views
0 likes
|
Last Post
by kempotrader
Today, 08:54 AM
|
||
Started by mmenigma, Today, 08:54 AM
|
0 responses
2 views
0 likes
|
Last Post
by mmenigma
Today, 08:54 AM
|
||
Started by halgo_boulder, Today, 08:44 AM
|
0 responses
1 view
0 likes
|
Last Post Today, 08:44 AM | ||
Started by drewski1980, Today, 08:24 AM
|
0 responses
4 views
0 likes
|
Last Post
by drewski1980
Today, 08:24 AM
|
Comment