Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Recursive Property Error ??

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

    Recursive Property Error ??

    Hi,

    I'm trying to set up a property variable and I keep getting a "Recursive Property" warning. If I continue to compile and ignore the warning I get a 'NinjaTrade.Strategy.BBL' already contains a definition for 'numBack' error on line 129. I'm stumped here since I have a number of other property declarations of the same format which don't cause an error............ thanks in advance for your help


    30 private int numBack = 1; (declaration located in Variable section of code)

    (following located in "properties" section of code)

    127 [Description("# of Days Back to set stopLoss")]
    128 [Category(
    "Parameters")]
    129 public int numBack
    130 {
    131 get { return numBack; }
    132 set { numBack = Math.Max(0, value); }
    133 }

    #2
    Just a typo on your side,

    must be

    public int NumBack (capital N)

    a.l.


    Comment


      #3
      Hi, thanks for the quick reply, the code compiles correctly now.

      Could you explain further the reason why there needs to a 'N' rather than an 'n'? I'm new to the c# language, I'm guessing this has to do with method vs. variable?

      Comment


        #4
        Great, thanks zweistein.

        You need a capital letter here to distinguish between the variable declared in the Variables region (lowercase: numBack).

        The public property gets its value from this variable, but is actually two separately declared variables.
        Last edited by NinjaTrader_RyanM1; 06-17-2010, 11:32 AM.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        647 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X