Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using Values from Another Indicator

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

    #31
    Hello jonesy73,

    That is likely ChartBars, that is only going to be available to the host indicator and only if it is applied to a chart directly,

    In C# you can check if any object is null by checking if it equals null, you can do that in a print like I previously suggested:

    Print(ChartBars == null);

    Comment


      #32
      I'm replying to an old thread but just wanted make sure I have this correct. If I want to access a variable I created in my Indicator in a strategy:

      In My Indicator at the top I have my variable definied:

      private int MyInt;

      Then at the bottom in the properties section I do this:

      public int MyInt
      {
      get { Update(); return MyInt; }
      }


      Now in My Strategy file:

      private MyIndicator MyIndicator1

      In State == State.DataLoaded:

      MyIndicator1 = MyIndicator(para1, para2, para3)

      Then to access the variable I want:

      MyIndicator1.MyInt

      Is this the correct way?

      Comment


        #33
        Hello several,

        You can find a sample of exposing a public variable in the following link, the code you have appears to follow that structure. You can confirm you have done the same by comparing against the code in the sample.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        596 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        343 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        556 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        554 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X