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 Mindset, 04-21-2026, 06:46 AM
            0 responses
            91 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            137 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            68 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            121 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            72 views
            0 likes
            Last Post PaulMohn  
            Working...
            X