Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy names with underscores show up as blank spaces in Strategy Analyzer

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

    Strategy names with underscores show up as blank spaces in Strategy Analyzer

    Hey fellas,

    I wanted to report what looks like a bug. If you have a strategy name with an underscore in it, it correctly shows up with the underscore in Ninjascript Editor but in Strategy Analyzer, the underscores appears as a blank space.

    Steps to duplicate:
    1. In Ninjascript editor, create a new strategy with name 'Test_101'.
    2. Save and Compile.
    3. Open Strategy Analyzer and notice that it shows up as 'Test 101'.

    #2
    Hello PN720,

    Thank you for the post.

    I wanted to check, how was the strategy originally created with the underscore in its name? Underscores should be illegal when creating scripts as this goes against the standard naming structure for C# classes. If you had used the NinjaScript editor as noted in step 1, the underscore should be automatically removed during typing.

    I would suggest avoiding using underscores in names in general and instead use PascalCase for naming scripts: https://msdn.microsoft.com/en-us/lib...(v=vs.71).aspx

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Oh.. ok. Now that I recheck it, you're right. When you are generating the script the first tie, the UI enforces the no underscore thing.

      However, I was creating the name in the script itself with the underscores and then renaming it via right-click on the Strategies List to the right, with the underscore.

      Comment


        #4
        Hello PN720,

        Thank you for clarifying.

        Yes in the code of the script we wouldn't be able to prevent that. In this case, I have previously put in a feature request to allow for underscores but it was instead recommended to use PascalCase and the UI was amended to remove underscores while typing. This is good because it makes all scripts match the same naming scheme which also is in line with C# coding standards.

        While you still can technically use an underscore in manual coding, it may produce undesirable results in the UI where the strategy may be listed as the platform is not necessarily expecting that underscores will be used.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Ok, I've removed all underscores from my scripts and script names.

          For future reference, you should make the same changes to your UI to not allow renames to include underscores.

          Comment


            #6
            Originally posted by NinjaTrader_Jesse View Post
            I wanted to check, how was the strategy originally created with the underscore in its name? Underscores should be illegal when creating scripts as this goes against the standard naming structure for C# classes. If you had used the NinjaScript editor as noted in step 1, the underscore should be automatically removed during typing.
            You are trying to mis-characterize the underscore from "NT engineering has a corporate disdain for the underscore in the underscore vs PascalCase debate" to "the underscore is illegal".

            NT does not get say that underscores are illegal.
            The language designers of .NET made that decision.
            Underscores are valid letters in C# variable names.
            An underscore can even be the first letter of a variable name.
            Class names, variable names, method names, all the same.
            An underscore is completely valid and 100% legal in C#.
            Period. End of Story. No contest.

            Now, if NT engineering fails to honor or use this feature of C# completely (within the scope of the Strategy Wizard or NinjaScript), well, that is an entirely separate issue.

            I use underscores anywhere and whenever I want.
            I have never had an issue.
            Not a single one.

            But I never use Strategy Wizard, either.

            Comment


              #7
              Hey again,

              So, I'm using underscores in my variable names to make things more readable. Is that going to be an issue later on then?

              Comment


                #8
                Originally posted by PN720 View Post
                Hey again,

                So, I'm using underscores in my variable names to make things more readable. Is that going to be an issue later on then?
                I sincerely hope not.
                If you have issues, they should be filed as bugs with NT support.

                Comment


                  #9
                  Hello PN720,

                  Just to clarify here, my comments were strictly about Class naming in relation to using NinjaTrader tools to generate scripts. NinjaTrader follows the standard naming guidelines for C# when using the NinjaTrader tools. For example, when generating a new script a new class is made, this is why the underscore is removed as a class should not contain an underscore: https://msdn.microsoft.com/en-us/lib...(v=vs.71).aspx
                  While you can technically use an underscore for a class name it would be bad practice.

                  bltdavid is also correct in the sense that C# does allow underscores to be used in variable names or in general. However, this does not apply to my comments regarding the Class name specifically and how the NinjaTrader tools generate names. You are free to use Underscores in your syntax as you would want to as long as that use is valid in C#.

                  Originally Posted by PN720 View Post
                  Hey again,

                  So, I'm using underscores in my variable names to make things more readable. Is that going to be an issue later on then?

                  Originally Posted by bltdavid
                  I sincerely hope not.
                  If you have issues, they should be filed as bugs with NT support.
                  Using underscores in your variable names should not matter unless you have malformed syntax, in that case you should just see a compile error. I would only suggest emailing support in this case if you run into an issue with a specific NinjaTrader tool (your original post is a good example). If you are just seeing compile errors due to bad naming, that should be obvious that the name cannot be used.

                  If you are not certain for the naming of variables or other items in your script, I always suggest referring to MSDN and their naming guidelines here: https://msdn.microsoft.com/en-us/lib...(v=vs.71).aspx

                  Please let me know if I may be of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment


                    #10
                    Using underscores never creates problems. ALL of my indicators names start with IT_. You have made it extremely difficult to do this in NT8.
                    eDanny
                    NinjaTrader Ecosystem Vendor - Integrity Traders

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by GussJ, 03-04-2020, 03:11 PM
                    11 responses
                    3,222 views
                    0 likes
                    Last Post xiinteractive  
                    Started by andrewtrades, Today, 04:57 PM
                    1 response
                    10 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by chbruno, Today, 04:10 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post chbruno
                    by chbruno
                     
                    Started by josh18955, 03-25-2023, 11:16 AM
                    6 responses
                    438 views
                    0 likes
                    Last Post Delerium  
                    Started by FAQtrader, Today, 03:35 PM
                    0 responses
                    10 views
                    0 likes
                    Last Post FAQtrader  
                    Working...
                    X