Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Access indicator value

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

    Access indicator value

    Hi,

    Could someone let me know what the line of code would be to access the data from the following indicator named CumulativeDepth attached. I would like to be able able to use the sum1 and sum2 elements but I keep getting errors. How is it that I can see the output on the output window but can't use it?. Why can't I get this to work?

    Regards,
    suprsnipes
    Attached Files

    #2
    suprsnipes, the indicator itself prints the info to the output window - if you would like to access the generated values from another (external) script, you would need to expose it first for access -

    Comment


      #3
      Expose it how? The SampleBoolSeries doesn't help very much. Where else can I find out how to do this is there any other posts on this topic?

      Comment


        #4
        suprsnipes, it helps by showing you the basic concept needed to expose

        a) a internal variable
        b) a non plotted dataseries

        Your current indicator would only print to the output window as of now, you would first of all need to add logic / signals you wish to expose, then the sample would show how to ensure this info could be accessed externally.

        Comment


          #5
          So in the SampleBoolSeries indicator is the following item I'm looking for?

          Code:
          exposedVariable = Close[0];
          I have tried adding in the OnBarUpdate section of the CumulativeDepth indicator the following two lines of code;

          Code:
          exposedVariable1=sum1;
          exposedVariable2=sum2;
          as well as in the Variables section.

          Code:
          private double exposedVariable1;
          private double exposedVariable2;
          which compiles ok. Is this what you mean, but I am still unable to access the exposedVariable1?

          Comment


            #6
            What parts did you change in the Properties section of your indicator? Is the Public property for exposed variable listed there as well now like in our sample?

            Comment


              #7
              I hadn't made any changes to the Properties section but I have now added the following;

              Code:
               
              [Browsable(false)]
                      [XmlIgnore()]
                      public double ExposedVariable1
                      {
                          // We need to call the Update() method to ensure our exposed variable is in up-to-date.
                          get { Update(); return exposedVariable1; }
                      }
                      
                       [Browsable(false)]
                      [XmlIgnore()]
                      public double ExposedVariable2
                      {
                          // We need to call the Update() method to ensure our exposed variable is in up-to-date.
                          get { Update(); return exposedVariable2; }
                      }
              I have been able to compile an indicator calling the exposed variables as follows and I'm now waiting to see if it works.

              Code:
              this.CumulativeDepth().ExposedVariable1

              Comment


                #8
                Thanks Bertrand for your help. I really appreciate it a valuable C# item to learn.

                Comment


                  #9
                  You're welcome, glad to hear this worked out well for your task.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  672 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  379 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  111 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  577 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  582 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X