Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

protection level error

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

    protection level error

    I am referrencing indicator "A" in indicator "B" . In indicator "A" I created a dataseries called mysignal which simply places a value of 1 when true. In indicator "B" I created another dataseries "Indicator1_data" which references "A" mysignal.

    Inside the protected override void OnBarUPdate() I have the following:

    Indicator1_data.Set(VPA(20).mysignal[0]);

    I have done this many times without any problems.

    However, in this particular case I am getting the following error:

    "NinjaTrader Indicator VPA.mysignal is inaccessible due to its protection level."

    What is my problem here?

    thanks,
    Last edited by velocity; 08-13-2009, 05:43 AM.

    #2
    velocity, is the to be accessed dataseries declared as public?

    Comment


      #3
      I don't understand what you are asking.

      Comment


        #4
        velocity, I'm referring to the properties section of your dataseries in the 'to be accessed' indicator as per this sample - http://www.ninjatrader-support2.com/...ead.php?t=4991

        If you're using Plots to display the mySignal dataseries it should be automatically exposed and accessible.

        Comment


          #5
          Got it! thanks for the help.

          Comment


            #6
            I'm still quite new to coding in general, and while this simple program is only meant to be a test to learn how constructors work, I'd still like to know why I'm getting this error. using System; ...



            Your problem is that, in C#, variables (in this case, fields) are marked as private if they are not specifically marked with an access modifier.

            Classes and structures default to internal, fields, methods, events, properties, etc (basically, all members of classes and structures) default to private.
            Changing int a to public int a (and the same for b/c) will fix it.
            Though, I recommend not doing that. Instead, make a property for each.

            public A { get { return a; } set { a = value; } }
            public B { get { return b; } set { b = value; } }
            public C { get { return c; } set { c = value; } }

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            558 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            545 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X