Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Errors when converting this script from Thinkscript to Ninjascript. Error Code CS1032

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

    Errors when converting this script from Thinkscript to Ninjascript. Error Code CS1032

    I have converted thinkscript to C# and input it into ninjascript but am getting a few errors i would like to work out. Any help would be GREATLY appreciated. I'm getting errors even in the code that is pregenerated when creating a new script.

    Ive attached all code and errors. I'm am sorry it is ALOT of code

    #2
    here is more of the code
    Attached Files

    Comment


      #3
      rest of code with errors.
      Attached Files

      Comment


        #4
        Hello NutButter,

        Thanks for your post.

        The error message 'Cannot define/undefine preprocessor symbols after first token in file' means that you cannot define a preprocessor unless it is at the beginning of a program, before any other keywords.

        When doing a Google search for ' CS1032 C# compile error' we can see an MSDN page in the search results stating: The define and #undef preprocessor directives must be used at the beginning of a program, before any other keywords, such as those used in the namespace declaration.

        ​If you are simply trying to set a value for a variable, you could leave out the define code and simply put show_zones = true; on line 54 in the code your shared, for example.

        If you are creating a bool or other type of variable, you could leave out define and simply put bool show_zones = true; on line 54, for example.

        This would be repeated for each compile error mentioning the 'Cannot define/undefine preprocessor symbols after first token in file' compile error.

        The error message '} expected' means that you are missing a closing curly brace somewhere in your script.

        Each opening curly brace '{' must have a closing curly brace '}' paired with it. To resolve these errors you would need to go through each line in your code to find which open curly brace is missing a closing curly brace paired to it. Once you find where the missing closing curly braces are needed, you could add those to the script.

        After resolving the compile errors mentioned above, run a compile in the NinjaScript Editor window to check for further errors that may occur.

        Let me know if I may assist further.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        567 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        330 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        547 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        548 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X