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 judysamnt7, 03-13-2023, 09:11 AM
            4 responses
            59 views
            0 likes
            Last Post DynamicTest  
            Started by ScottWalsh, Today, 06:52 PM
            4 responses
            36 views
            0 likes
            Last Post ScottWalsh  
            Started by olisav57, Today, 07:39 PM
            0 responses
            7 views
            0 likes
            Last Post olisav57  
            Started by trilliantrader, Today, 03:01 PM
            2 responses
            21 views
            0 likes
            Last Post helpwanted  
            Started by cre8able, Today, 07:24 PM
            0 responses
            10 views
            0 likes
            Last Post cre8able  
            Working...
            X