Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Region(). Signature error in documentation?

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

    Draw.Region(). Signature error in documentation?

    If one wishes to displace a DrawRegion, we have documented this (inter alia)":
    Code:
    Draw.Region(NinjaScriptBase owner, string tag, int startBarsAgo,
             int endBarsAgo, ISeries<double> series1, ISeries<double> series2, Brush outlineBrush,
             Brush areaBrush, int areaOpacity, [int displacement])
    However, that throws an error identifying the "[" and "]" on [int displacement] as errors. Leaving out the square brackets allows compilation and use.

    Which is which? Is a correction needed, or am I reading it wrong, or am I doing something wrong?

    #2
    I've seen this in VS with Intellisense before. The optional parameters, meaning not required to be set when calling, are in [ ] while the ones required are not.

    If you don't set it then it defaults to 0.

    In this case its to let us know that there is a parameter for Displacement which we can choose to set or not set in our calls.

    It also avoids having to create a whole new overload method for one parameter
    Last edited by Calonious; 08-27-2015, 02:22 PM.

    Comment


      #3
      Originally posted by Calonious View Post
      I've seen this in VS with Intellisense before. The optional parameters, meaning not required to be set when calling, are in [ ] while the ones required are not.

      If you don't set it then it defaults to 0.

      In this case its to let us know that there is a parameter for Displacement which we can choose to set or not set in our calls.

      It also avoids having to create a whole new overload method for one parameter
      That may well be true, but it causes an ambiguity. In NT, we use the square brackets for indexing, and a displacement is specifying an index. Moreover, that is not standard C# for an optional parameter. Optional parameters are defined with a definition and an equals sign, so correctly would be stated as Draw.Region(/*the required parameters*/, int displacement = 0).

      Whereas, the square brackets in Intellisense does indicate optional parameters, we need to have the correct syntax in the documentation. I am not too sure that I am not nit-picking here, but I have been known to do that on occasion.

      ref: https://msdn.microsoft.com/en-us/lib...v=vs.120).aspx

      Comment


        #4
        Went back and forth between matching intelliprompt and the core signature declaration, but you're right - thanks. Fixed.
        MatthewNinjaTrader Product Management

        Comment


          #5
          Originally posted by NinjaTrader_Matthew View Post
          Went back and forth between matching intelliprompt and the core signature declaration, but you're right - thanks. Fixed.
          I am supposed to know this, and yet it confused me a bit. Maybe you could put a link to the MSDN article, directly with the signature definitions? That way, a user may be able to figure it out on his/her own? The CS compilation errors that come up in this case were pretty useless.

          Comment


            #6
            That is certainly a point to consider -- good food for thought. If it can fool you, it can probably fool quite a few people.
            Dave I.NinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            662 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            376 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            110 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            575 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            580 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X