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

NinjaTrader.Indicator is a namespace but is used as a type

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

    NinjaTrader.Indicator is a namespace but is used as a type

    My @Strategy.cs all of a sudden started throwing this compile error and I cannot for the life of resolve it. Can someone please help on how to fix this? I replace the file with a brand new copy, but it keeps coming back. I am lost.

    Thanks in advance.

    #2
    Hello amilanoski,

    Thanks for your post.

    It is a general indication something is wrong with some code, likely of an indicator.

    Please follow the instructions below to see where the errors are coming from after compiling the indicator. This will allow you to debug the indicator/strategy or remove it from your PC. If you are wondering why you receive an error when compiling only one indicator, it is because NinjaTrader always compiles all indicators and strategies - not just one. This is done to give you the highest runtime performance possible.
    • Open NinjaTrader
    • From the Control Center select the New menu--> select NinjaScript Editor
    • Double click on the Indicators folder--> then double click on any of the indicators
    • Once the indicator code is in view right click in the window and select Compile to compile all NinjaScript objects
    • At the bottom of the NinjaScript Editor window, a new section will appear where you can find the error locations
    • You can exclude the file referenced in the editor by double clicking on the appropriate object type on the right of the NinjaScript Editor window. This will expand the object type folder. You can then select the file with a left click--> right click on the object--> then select Open to begin debugging the file, Exclude From Compilation, or Remove to delete the file.
    If this does not help to resolve, please post a a screenshot of all the error messages. Make sure to show the entire message and all columns. Please see the example here:https://ninjatrader.com/support/help...ile_errors.htm

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      HI there,

      Yeah I did that and the only error that is coming up is this error. Attached is my screenshot.
      Attached Files

      Comment


        #4
        Hello amilanoski,

        Thanks for your reply.

        Please double left click on the error message as this will open the file and should show the line (line 23) that is providing the error.
        Please post a screenshot of the file when opened.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Sorry I thought that was in the original screenshot. See attached now.
          Attached Files

          Comment


            #6
            Hello amilanoski,

            Thanks for your reply.

            The @Strategy file appears correct so the likely suspect would be a custom Indicator that is not generating the "NS code wrapper" that a strategy would use. IE the code that start with this line: #region NinjaScript generated code. Neither change nor remove.

            If you have recently imported or modified an indicator, I would suggest going through the Ninjascript explorer window and right mouse click on recently imported or recently modified indicator and right mouse click on the indicator file and select "exclude from compilation". when you do that the system will recompile and if that clears the error then you have found the source file of the issue.

            Paul H.NinjaTrader Customer Service

            Comment


              #7
              i have in a different case error cause by namespace as well, was told to remove an instance of xxxx.base from all places after placing a reference in Using at the top of indicator

              which i did, but the only instance i found after that to remove xxxx.base was the actual line that say "namespace xxxx.Base

              can you have "namespace" without anything next to it

              thanks

              this indicator is in a folder when i look for the indicators in the script editor - i have been told that could have something todo with the issue
              i saved as a new name and removed the reference to the folder, i now appears when a ad to a chart as normal, but remains in the folder in the script editor

              HOW TO I GET IT OUT OF THE FOLDER

              Last edited by DTSSTS; 10-27-2021, 10:07 PM.

              Comment


                #8
                Hello DTSSTS,

                Thanks for your post.

                "HOW TO I GET IT OUT OF THE FOLDER". In the Ninjascript editor window, on the ninjascripot explorer window, open the folder, left click on the file and drag the file out of the folder and let go. This will move the file out of the folder and will remove the reference to the folder and recompile the indicator.

                When you put a script in a folder, it changes the "Namespace" to include the folder. For example, the following is from an indicator called SettlementLines that is within the folder Settlement:

                namespace NinjaTrader.NinjaScript.Indicators.Settlement
                {
                public class SettlementLines : Indicator


                When I drag that file out of the settlement folder, this is what gets changed:

                namespace NinjaTrader.NinjaScript.Indicators
                {
                public class SettlementLines : Indicator
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  I was hoping to get this to compile in a strategy builder, a forum shows change part of the code and it working, but I have had no success
                  I did move to regular indicator folder and copy .cs files into that folder, then removed the ones from compilation in the folders as well, with that the compile error instead of the error of xxx.base showing up I now only have the error of the namespace is used like a type, same as last night
                  I DID GO THRU THE INDICATORS ONE BY ONE from compilation but the only revert between this error and the one where the xxx.base has errors

                  the suggestiion in the forum that is suppose to fix this was removing all xxx.base in the strategy, but of course that has to be unlocked, and i am not at that point yet on the strategy, like to get as much done in NOT unlocked mode first

                  I am just going to wait a few days see if my programmer can debug the entire indicator
                  thanks

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by pechtri, 06-22-2023, 02:31 AM
                  9 responses
                  122 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by frankthearm, 04-18-2024, 09:08 AM
                  16 responses
                  64 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Started by habeebft, Today, 01:18 PM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by benmarkal, Today, 12:52 PM
                  2 responses
                  13 views
                  0 likes
                  Last Post benmarkal  
                  Started by f.saeidi, Today, 01:38 PM
                  1 response
                  7 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Working...
                  X