Throughout the lifecycle of my indicator, (https://ninjatrader.com/support/help...tsub=configure) how can I determine where the indicator is being loaded? (to show on a graph vs Available list. vs Properties)?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Where is my indicator loading?
Collapse
X
-
Hello jmneto,
Thanks for opening the thread.
State.SetDefaults will be called when the indicator gets added in the Indicators dialog window. This adds in the default values to the property grid.
State.Configure occurs when the indicators settings get applied.
State.DataLoaded will be called when the NinjaScript has loaded its necessary data and is then ready to process. This can be refered to as the first "Data Processing State."
State.Historical will begin for the indicator's data processing.
State.Transition will occur when the indicator transitions from historical data to realtime data.
State.Realtime will be noted after the NinjaScript has transitioned from historical data to realtime data processing.
When the indicator is removed or the chart is closed, State.Terminated will be called.
To better visualize this process, I suggest adding a print for State in OnStateChange().
Publicly available documentation and further reading for OnStateChange() can be found here - https://ninjatrader.com/support/help...tatechange.htm
Please let me know if we can be of further help.
-
Thanks for your reply. I understand those events. I am actually looking for a property or something else that can tell me where my indicator is being cloned to. For example, is my indicator being cloned because I am adding an Alert or is it being cloned to show in the indicator properties window?
Comment
-
Hello jmneto,
Thanks for clarifying.
I am not aware of a way where you can see which type of window an indicator is getting cloned to, but we do know the window that the indicator is getting created in and we can look at the Parent of that indicator and see if it uses ChartControl to determine if the indicator is applied to a SuperDOM, Market Anaylzer, Chart or Strategy.
Keep in mind, accessing Parent is technically unsupported and is not locked into documentation. While this may work now, there may be changes to NinjaTrader that may break this in the future. Please be sure to verify any unsupported functionality with any new releases in case issues arise.Code:if (Parent is MarketAnalyzerColumnBase) Print("Running on a Market Analyzer"); else if (Parent is IndicatorSuperDomBase) Print("Running on a SuperDOM"); else if (ChartControl != null) Print("Running on a Chart"); else Print("Running from a Strategy");
This will not differentiate if an indicator is applied to an Alert, however. I would then recommend creating a new version of that indicator specifically for a Alerts if you wish to separate some behavior specifically for Alerts.
As far as seeing where the clone is happening for the LiffeCycle, there wouldn't be a way to directly identify which "stage" the indicator is going through. I. E. the steps 1, 2, and 3 in the LifeCycle doc's flow chart. But you could use a private variable for the last state that was hit to better determine which "stage" the NinjaScript is in.
Please let us know if we can be of further assistance.Last edited by NinjaTrader_Jim; 06-08-2018, 10:20 AM.
- Likes 1
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
577 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment