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
Exposing Complex Indicator Values
Collapse
X
-
Hello Zeos6,
I have the requested sample attached.
The general gist for exposing a variable/class/struct and accessing it externally is to create a public instance of that variable/class/struct.
Please keep in mind that while we support our product, providing educational samples to demonstrate C# concepts begins to exceed the scope of support that we may offer. As these concepts can get more and more complex, our ability to answer client inquiries on the platform becomes increasingly difficult.
If there is anything else I can do to assist, please let me know.Attached FilesJimNinjaTrader Customer Service
Comment
-
Thank you Jim. I do understand and very much appreciate this.
Normally, when simple value types are exposed for sharing, an Update() is used. This is not done in the sample you provided. How can one ensure that the shared complex entities are at their most current values?Last edited by Zeos6; 09-13-2017, 10:08 AM.
Comment
-
Hello Zeos6,
Since I could not place a getter directly within the public class, I made sure to call SampleSharedClassesAndStructs().Update(); from the Strategy that calls it.
You could move the Update() call to a getter for the declaration of the public SharedClass and also create private SharedClass that can act as the return value for the getter of the public class.
For example:
Code:private SharedClass myClass; public SharedClass MyClass{get { Update(); return myClass; } set{myClass = value;} }
If there is anything else I can do to be of further help, please let me know.JimNinjaTrader Customer Service
Comment
-
Hello roblogic,
Update() should be used to ensure properties are up to date when the hosting script accesses those properties. Best practice would be to include Update() in the getter of that public property, but this cannot be done for all of these types. Series objects would not need the Update call added to the getter, but other properties would. If the property cannot have Update applied in the getter, than the next best option is to call Indicator.Update() in the hosting script as done in line 63 of SampleSharedClassesAndStructsStrategy.
We look forward to assisting.
JimNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by fwendolynlpxz, Today, 05:19 AM
|
0 responses
1 view
0 likes
|
Last Post Today, 05:19 AM | ||
Started by traderqz, Yesterday, 12:06 AM
|
11 responses
27 views
0 likes
|
Last Post Today, 05:11 AM | ||
Started by PaulMohn, Today, 03:49 AM
|
0 responses
8 views
0 likes
|
Last Post
by PaulMohn
Today, 03:49 AM
|
||
Started by inanazsocial, Today, 01:15 AM
|
1 response
10 views
0 likes
|
Last Post Today, 02:18 AM | ||
Started by rocketman7, Today, 02:12 AM
|
0 responses
11 views
0 likes
|
Last Post
by rocketman7
Today, 02:12 AM
|
Comment