Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Tip: Using multi-line comments

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

    Tip: Using multi-line comments

    I was perplexed that most of the default sample scripts I have look at so far are using two forward slashes at the start of each line to mark a comment section.

    Here is a tip:

    If your comment will run on for multiple lines, write the comment likes this:

    /*
    hi
    this
    is
    a
    multiline
    comment
    */

    I'm not sure if the original comment method was an artifact from an earlier version of ninjascript.

    I know one of the toolbar icons in the editor operates by inserting / removing double forward slashes in front of each selected line, maybe this could be updated in future version 8?

    #2
    Hello balltrader,

    The comments use double lines so that the NinjaScript editor can comment uncomment selected text. Using /* */ for a block of text makes this much more difficult.

    You will find that many examples sent by our staff with multi-line comments will have the comment blocks instead of single line comments. However, our official samples will not.

    Are you requesting that we recode all scripts be recoded to use comment blocks instead of single line comment marks?

    If so, I will enter this as a feature request in your behalf. It is up to our development to decide if a feature request will be implemented and when.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      ha ha that is funny
      no way do I expect you to recode all your scripts, who would pay for that? lol

      i was just making a suggestion to coders, that if you are writing a multi-line comment, use the multiline comment style /* */

      which is a different concept than if you are trying to quickly comment out a chunk of code using the toolbar buttons for testing / debugging

      I am not requesting a feature change to the toolbar icon behavior onclick event. I can understand the purpose and utility of that.

      thank you.

      Comment


        #4
        @NinjaTrader Chelsea, can you confirm if there is any performance hit from including long length comments in the script, or since the script is compiled, are the comment (qty and length) of no concern?

        Comment


          #5
          Hello balltrader,

          No, the comments do not cause a performance hit and are not parsed by the computer.

          http://stackoverflow.com/questions/1...ow-down-perfor
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Thanks, I preferred verification instead of just assuming.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by terofs, Yesterday, 04:18 PM
            1 response
            22 views
            0 likes
            Last Post terofs
            by terofs
             
            Started by CommonWhale, Today, 09:55 AM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by Gerik, Today, 09:40 AM
            2 responses
            7 views
            0 likes
            Last Post Gerik
            by Gerik
             
            Started by RookieTrader, Today, 09:37 AM
            2 responses
            13 views
            0 likes
            Last Post RookieTrader  
            Started by alifarahani, Today, 09:40 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X