Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can't import owing to files with bad code

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

    Can't import owing to files with bad code

    I am not sure whether this is a request for help or a request for a new program feature. Probably both.

    When I attempt to import a NinjaScript add-on, NT complains, "You have custom NinjaScript files on your PC that have programming errors. These errors must be resolved before you can import a NinjaScript Archive file."

    Note the absence of any hint to what files are causing the problem, or even where they might be found. This is an unfortunate omission, and fixing this is my feature request. Nothing is more useless than telling your doctor "I hurt" without being able to tell him/her where.

    I have spent two days deleting a few .sln files just to make sure and then deleting .cs files, dozens of .cs files, including some for imported indicators I know work. At this point, a really good search utility turns up no .cs files that lack the NinjaTrader copyright. NT is still complaining.

    So the help request: How do I find out what NT dislikes? How do I find files that contain C# code but are not .cs files and lack a using.System declaration?

    This is really limiting my ability to use NT, as there are several add-ons that help me a lot. I will be very grateful for any help getting past this obstacle.

    #2
    Hello owen5819,

    Thank you for posting.

    This message indicates that there are NinjaScript errors on your platform that need to be resolved before you can import or edit any others. To begin resolving this, do the following:
    • Go to the Control Center > New > NinjaScript Editor
    • Right-click in the NinjaScript Editor > select 'Compile'
    You should see some errors in orange appear at the bottom of the window. Expand this window so that as many of these error messages, if not all of them, are visible.

    A visual walkthrough of this process along with solutions to common compile errors may be found here in our Help Center.



    CS0006 - Explanation of Cause

    This error is caused when a .dll file is being referenced that NinjaTrader is unable to find.

    Steps to Resolve
    1. Right-click within the NinjaScript Editor window and select "References".
    2. Locate and select the reference to the .dll file mentioned in the Error.
    3. Click "remove" to remove the reference.
    4. Click "OK" and recompile.
    Below is a link to our publicly available YouTube channel overviewing this process:
    https://youtu.be/qvm2GtTcn4Q

    CS0246 - Explanation of Cause

    This error is caused when NinjaTrader is searching for a reference to a .dll file, and the reference does not exist.

    Steps to Resolve
    1. Right-click within the NinjaScript Editor window and select "References".
    2. Click "Add".
    3. Locate the .dll file for the file mentioned in the error.
    4. Click "Open" to add the reference.
    5. Click "OK" and recompile.
    Below is a link to our publicly available YouTube channel overviewing this process:
    https://youtu.be/fj1KliUjTC4


    CS0234 - Explanation of Cause

    This error indicates that a system indicator is missing from the NinjaTrader 8 -> bin -> Custom -> Indicator folder, or a corrupt file is currently present.

    Steps to Resolve
    1. Shut down NinjaTrader
    2. Navigate to Add/Remove Programs within the user's PC's Control Panel.
    3. Click "NinjaTrader 8" in the list of installed programs to select it.
    4. Click "Repair".
    5. Finally, restart NinjaTrader and recompile.
    Below is a link to our publicly available YouTube channel overviewing this process:
    https://youtu.be/8lcz8IIc144

    Please let us know if we can be of further assistance.



    Christopher J.NinjaTrader Customer Service

    Comment


      #3
      Hi owen,

      in many cases this procedure might help to find the file....

      ​​Click image for larger version

Name:	2024-11-12_17-38-50_Program_Manager.gif
Views:	37
Size:	335.1 KB
ID:	1324394

      Comment


        #4
        Christopher and ToNovy, many thanks for your help. It's appreciated. Very cool directions, ToNovy.

        Christopher, many of the references are to things like System.dll and System.Core.dll. Some are to .dll files in the Microsoft.NET/Framework64/ folder. It seems unlikely that they can't be found. Shall I go ahead and delete the references?

        Clicking on "compile" brings up A LOT of messages that "The name 'indicator' does not exist in the current context." All the references I have checked so far are to code at the end of the file

        Many of these apply to NT's own functions; @ADX.cs, for example. The position in question is line 175, character 11. Here is the code:

        namespace NinjaTrader.NinjaScript.Strategies
        {
        public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
        {
        public Indicators.ADX ADX(int period) //This is line 175.
        {
        return indicator.ADX(Input, period);
        }

        public Indicators.ADX ADX(ISeries<double> input , int period)
        {
        return indicator.ADX(input, period);
        }
        }
        }

        Just above it, namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns contains the same lower-case "indicator" but does not throw an error.

        In @Aroon.cs, namespace NinjaTrader.NinjaScript.Strategies contains two of these lines; return indicator.Aroon(Input, period); They both throw the same error.

        Given that this is NinjaTrader's own code, this seems ridiculous. What do I do about it?

        Comment


          #5
          Please use the steps provided below to repair your installation:
          • Close NinjaTrader
          • Go to your Windows Control Panel
          • Select "Uninstall a program"
          • Select NinjaTrader 8
          • Click Repair
          • Once completed open NinjaTrader
          Please let me know if the issue persists after this procedure.
          ​​
          Christopher J.NinjaTrader Customer Service

          Comment


            #6
            So far, the problem has survived two uninstall/repair procedures. I will try again and see whether anything has changed.

            Comment


              #7
              It survived that one, too. However, when I clicked Compile again, this time it offered me the opportunity to block two files from being compiled. I did it, and now everything works fine. The odd thing is that I would have sworn I had deleted those files along with so many others. Anyway, thanks for your help.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              55 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              37 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              17 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              19 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              49 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X