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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            128 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            73 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            116 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            109 views
            1 like
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            88 views
            0 likes
            Last Post CarlTrading  
            Working...
            X