Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exposing Complex Indicator Values

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Exposing Complex Indicator Values

    I know that it is possible to expose simple value types or series objects but is it possible to expose a complex indicator value, for example a class, struct, or tuple? If yes, can you provide a code sample/ Thank you.

    #2
    Hello Zeos6,

    Thanks for the inquiry.

    I'll see what I can come up with.

    Comment


      #3
      Thank you very much Jim. Much appreciated.

      Comment


        #4
        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 Files

        Comment


          #5
          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


            #6
            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;} }
            This would not be possible for structs and would be redundant since a struct is a Value Type and would return a new copy of the value.

            If there is anything else I can do to be of further help, please let me know.

            Comment


              #7
              Got it. Thank you very much for the clarification Jim. Appreciate your help.

              Comment


                #8
                I just found this interesting thread!

                So to sum up:

                If a Struct is exposed, then there is no need to call the Update()

                But if it is a Tuple, or a List that are exposed then the Update() should be called. Is that correct?

                Comment


                  #9
                  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.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  640 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  366 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  107 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  569 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  572 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X