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
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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.JimNinjaTrader Customer Service
-
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.
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.JimNinjaTrader Customer Service
- Likes 1
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by lakman184, 03-24-2024, 01:30 PM
|
4 responses
26 views
0 likes
|
Last Post
by morpheus0
Today, 10:20 AM
|
||
Started by thumper57, 05-11-2024, 04:30 PM
|
15 responses
44 views
0 likes
|
Last Post Today, 10:19 AM | ||
Started by Salahinho99, 05-05-2024, 04:13 AM
|
10 responses
70 views
0 likes
|
Last Post Today, 10:12 AM | ||
Started by lorem, 04-25-2024, 09:18 AM
|
13 responses
56 views
0 likes
|
Last Post Today, 10:00 AM | ||
Started by llanqui, Yesterday, 11:10 AM
|
3 responses
24 views
0 likes
|
Last Post Today, 09:56 AM |
Comment