Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NinjaScript must be in a compilable state to create or edit Strategies error

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

    NinjaScript must be in a compilable state to create or edit Strategies error

    So yesterday one of my strategies would uncheck itself when applied in the strategy window. Although the strategy compiled fine and even ran fine in the strategy analyzer the error I was getting was something about accessing an index out of range. I searched the forums and followed some advice to enable debug mode and open the strategy script in Visual Studio where I compiled it, set a breakpoint and reviewed it, then removed it and successfully ran the strategy with no error for hours with no changes made.

    Today however again, no changes made whatsoever but when I fire up Ninjascript editor I get the above error and was unable to open any of my scripts. I had however saved the workspace with a few other scripts open and when trying to compile those I get this error:

    Source file '\\Mac\Home\Documents\NinjaTrader 8\bin\Custom\obj\Debug\.NETFramework, Version=v4.8.AssemblyAttributes.cs' could not be found. The error code in the next column is CS2001.

    I checked and yes, there's no such file.

    Besides wondering how I can resolve this issue, my questions is also why did this error start happening? What happens between the handoff to VS Studio 2002 and then closing that solution that now breaks NinjaScript Editor so effectively.

    Things I have already tried which have not worked:

    1. Making sure the Debug Mode is unchecked on all open scripts and recompiling
    2. Opening the code back in VS Studio 2022 and recompiling - it builds fine with no errors but the NinjaScript Editor remains broken.

    Edit: now tried building the entire NinjaTrader.Custom in VS Studio and I get 662 conflict warnings CS0436. Pic attached.


    Any suggestions?

    Click image for larger version

Name:	Screen Shot 2022-09-15 at 8.30.16 AM.png
Views:	1141
Size:	456.6 KB
ID:	1215629
    Attached Files
    Last edited by markdshark; 09-15-2022, 07:34 AM.

    #2

    Comment


      #3
      Hello markdshark,

      Attempting to compile in Visual Studio will break NinjaTrader by generating an AssemblyAttributes.cs file.

      Do not compile in Visual Studio. Compile only in NinjaTrader's Ninjascript Editor.

      The NinjaScript Editor also monitors files for changes. If you save 'Ctrl + s' a script in any editor, including Visual Studio, while the NinjaScript Editor is open, this will automatically trigger NinjaTrader to compile.

      Just save the script in the external editor while the NinjaScript Editor is open. Do not compile with an external editor.

      To resolve the error delete the 'Documents\NinjaTrader 8\bin\Custom\obj' folder.

      Below is a link to a google search of 'AssemblyAttributes' which lists forum threads where this is discussed.
      https://www.google.com/search?q=site...mblyAttributes
      Last edited by NinjaTrader_ChelseaB; 09-15-2022, 09:10 AM.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Thank you that solved it!

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello markdshark,

          Attempting to compile in Visual Studio will break NinjaTrader by generating an AssemblyAttributes.cs file.

          Do not compile in Visual Studio. Compile only in NinjaTrader's Ninjascript Editor.

          The NinjaScript Editor also monitors files for changes. If you save 'Ctrl + s' a script in any editor, including Visual Studio, while the NinjaScript Editor is open, this will automatically trigger NinjaTrader to compile.

          Just save the script in the external editor while the NinjaScript Editor is open. Do not compile with an external editor.

          To resolve the error delete the 'Documents\NinjaTrader 8\bin\Custom\obj' folder.

          Below is a link to a google search of 'AssemblyAttributes' which lists forum threads where this is discussed.
          https://www.google.com/search?q=site...mblyAttributes

          Hello ChelseaB,

          I'm getting the same error ('NinjaScript must be in a compilable state to create or edit strategies'), on a newly installed version of NT8, and on the first attempt to create a strategy in Strategy Builder.

          I'm relatively new to Ninjatrader and unfamiliar with much of the usage terminology. I don't know what "Visual Studio" is, and as far as I know I haven't compiled anything there.

          I've also accessed the 'Documents\NinjaTrader 8\bin\Custom' folder, and there is no 'Job' folder in there.

          Any suggestions?
          Last edited by Jazzman53; 12-25-2024, 07:32 PM.

          Comment


            #6
            Originally posted by Jazzman53 View Post


            Hello ChelseaB,

            I'm getting the same error ('NinjaScript must be in a compilable state to create or edit strategies'), on a newly installed version of NT8, and on the first attempt to create a strategy in Strategy Builder.

            I'm relatively new to Ninjatrader and unfamiliar with much of the usage terminology. I don't know what "Visual Studio" is, and as far as I know I haven't compiled anything there.

            I've also accessed the 'Documents\NinjaTrader 8\bin\Custom' folder, and there is no 'Job' folder in there.

            Any suggestions?
            i
            Update: I've fixed the problem. It was caused by me bypassing the correct path to import a third party indicator. I had purchased and used this indicator in a prior version of NT8.

            After installing the new version of NT8 I wanted to import this indicator but I had lost it's zip file-- so I was unable to import it using the Control Panel/Import/NjinjaScript Add-On path.

            So; I bypassed the NinjaScript Add On path and copy/pasted the indicator's .cs & .dll files from the "OLD" NT8 folder into the new NT8/bin/Custom folder.

            The indicator worked fine but bypassing the import path in this way apparently caused the error code. After deleting the indicator's .cs & .dll files from the NT8 folder, the error code went away and I can now use Strategy Builder.

            That indicator cost me $150 and I really don't want to purchase it again so I'm wondering if there is another way to import it, since all I have of it are it's .cs and .dll files. I'm guessing that the original zip file contained a third/instruction file which didn't save into the NT8 bin/Custom folder.

            Does anyone know how to do this?
            Last edited by Jazzman53; 12-25-2024, 08:10 PM.

            Comment


              #7
              Hello Jazzman53,

              If you can provide the files, I may be able to create an export out of it.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_ChelseaB View Post
                Hello Jazzman53,

                If you can provide the files, I may be able to create an export out of it.
                Thanks for indulging my inexperience, and for that generous offer to help but I was finally able to zip those files back up and import them the correct way, and everything works now!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                61 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                39 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                21 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                23 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                51 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X