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

Remove an Input Question

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

    Remove an Input Question

    I have an indicator that requiires no inputs. I created an indicator using the wizard with no inputs (plots or inputs). It will not compile. I then tried to create an indicator using the wizard with 1 input. That complies. I then deleted the lines of code that reference MyInput0 but that doesn't compile either. I found this similar question asked by Mindest "How do you remove an input." The reply was do delete all references to the input you want to delete. I tried that on the code from the file he supplied and that compiled. Any ideas on what I'm missing?

    Thanks

    #2
    ramckay,

    Without seeing the code you are dealing with its hard to comment on what you might be missing.

    There is a section in the bottom of the NinjaScript code that references the user defined inputs something like this :

    public int Period
    {
    get { return period; }
    set { period = Math.Max(1, value); }
    }

    This also must be deleted if you delete "period" from the variables section.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Hi Adam,

      Not sure how to include a file of so here's the code. I've removed the references to myInput0 but get a complie error
      Indicator does not contain a defination for 'MyInput0' and no extension method 'MyInput0' accepting a first argument of type 'NinjaTrader Indicator.BarNumberBelowBar01' could be found (are you mising a using directive or an assembly reference?)
      Code:
       
      #region Variables
      // Wizard generated variables
      // private int myInput0 = 1; // Default setting for MyInput0
       
       
      /*
      [Description("")]
      [GridCategory("Parameters")]
      public int MyInput0
      {
      get { return myInput0; }
      set { myInput0 = Math.Max(1, value); }
      }
      */

      These are the only two references in the code that contain myInput0 other than the Wizard generated code. I tried deleting it there but it gets replaced when I complie.

      Also where do I find instuctions for including a file?

      Thanks

      Comment


        #4
        rammckay,

        The code is located in My Documents / NinjaTrader 7 / bin / custom / indicator.

        It will be named something like BarNumberBelowBar01.cs

        Please attach this code so we may take a look. You can attach files to post using the "Go advanced" option below your reply.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          HI Adam,

          Here's the file.

          Thanks
          Attached Files

          Comment


            #6
            ramckay,

            On like 183, 188, 189, 195 and 206 you need to remove any reference to input0. This is where its defining some constructors for the indicator and the input0 is included as user defined input there.
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              Hi Adam,

              Thanks for the quick response. I removed the references to myInput0 in lines 183, 188, 189, 195, and 206 and compiled. I still got the same error messages and the code that I'd removed had been replaced. I then removed references to muInput0 from lines 170, 172, 179, 183, 188, 189, 195, 206, 232, 234, 241, 243, 258, 260, 267, and 272. That was all of the lines the were marked with a search for "myInput0". I then saved the file. All of the deletions had beed replaced. I removed them all again and compiled. I got the same error messages and all of the code had again been replaced. Am I missing something? Why are those deletions being replaced?

              Thaks

              Rod

              Comment


                #8
                ramckay,

                They shouldn't be replaced, so I am not sure why that occurred. Ill try to replicate with your indicator. How did you replaced them? They should be replaced with blank entries, and no commas on either side.
                Adam P.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Adam,

                  I deleted them by highlighting what I wanted to get rid of and the hitting the delete key. They all disappeared just like any editor. Is there anything that could be on my computer like another indicator that has myInput0 in it? The file I'm doing the work on is a copy of another indicator. It has a myInput0 variable in it which I also couldn't delete. I set it to internal in the properties so that it dosen't show in the Parameters section.

                  Comment


                    #10
                    ramckay,

                    If you didn't do a right click in editor > save as, it wont update the class names appropriately so it would explain the issue since you would have a duplicate. Is this the case?
                    Adam P.NinjaTrader Customer Service

                    Comment


                      #11
                      I think the problem that you're running into is all the references to "Brooks Charts" try deleting /commenting those.

                      Hope this helps.

                      VT

                      Comment


                        #12
                        As a follow up and if there is still a problem (which there probably is) or for future reference.

                        The problem with the file above is that the constructors are not correct for the file. This is a problem that you may encounter, when you move files around as .cs files instead of using the export NinjaScript utility. You can do it, but it can also be a source of problems if the files have been modified and not been recompiled properly within NT.

                        Down in the "NinjaScript generated code" region is where NinjaScript does a lot of important work, including building the constructors. And as it says, Neither Change nor remove" it, there should be no need, if you follow proper procedures. Such as using "Save as" to rename files, and letting it generate the code in that region.

                        I do all my coding in Visual Studio, but when I want to make a new version/copy/rename a file. I always open the file I want to copy in the NT editor and right-click "save as" and give it a new name, then compile it, and then open it in Visual Studio. When the work is done in Visual Studio, I save it in VS and then compile any other file (except the one I was modifying) in the NT editor. This process allows NinjaScript to generate all the code the correct way.

                        As for the file above, the NS generated constructors etc are expecting a myInput0 input, that is why it kept adding lines back in when they were deleted. The only way (or the best way) to prevent that is to simply give it what it wants. Uncomment the myInput0 from the Variable and Properties regions, then compile it and let it generate the code correctly (it should compile fine). Then comment them back out from Variables and Properties regions and compile it again. That allows NinjaScript to re-generate all the constructors and other code it needs.

                        Hope this helps.

                        VT
                        Last edited by VTtrader; 03-13-2012, 09:28 PM.

                        Comment


                          #13
                          VT_Trader and Adam,

                          Thanks for the suggestions guys. I'm making some progress here I think. I was working the problem on a different machine and the original directions Adam gave me worked - just delete then lines of code in the file that contained myInput0 in the variables and properties section. So I'm assuming that there's something wrong with the application on the other machine. So far so good. I decided to start with a clean slate so I exported the indicator and deleted the indicator in NT. Also, I took the indicator of all the charts and opened a new chart in a new workspace. I then tried to import the indicator I'd just deleted. I got the error messge "Import failed. The NinjaScript Archive File may contain duplicate method names that already exist on your PC or there is a required file missing on either your PC or in an import archive." I doubt there's a file missing because all I had done was delete the indicator. I did a search for the indicators name. There is dll file in the bin/custom/indicator folrder. I deleted that. I then tried to again import the file and get an error message "You have custom NinjaScripts files on your PC that have programming errors. These errors must be resolved before you can import a NinjaScript Archive File." The routine I used to delete the indicator was to open the indicators using Tools/Edit NinjaScript/Indicator, select the Indicator, and then click the delete button. It didn't get rid of the .dll. Is there someplace I can get directions on how to properly delete an indicator and its associated .dll file? I think the problem wil be solved then.

                          Thanks,

                          Comment


                            #14
                            ramckay,

                            First I would open an indicator in the NT editor (any will do), then try to compile. It will most likely fail, and you'll get an error message at the bottom of the editor (probably in orange). If you could take a screenshot of that and post it, I'll take a look.

                            You can remove an assembly in Control Center go to File->Utilities->Remove NinaScript Assembly and remove it from there. You can also right click in the editor and choose "References" and delete the reference. It won't remove the .dll file from the folder but breaks the dependency on it.

                            Personally, I would first try to compile and find what and where the error is, than to start blindly removing/deleting assemblies and references.

                            VT

                            Comment


                              #15
                              VT,

                              Thanks. I'm currently reinstalling NT and hoping to correct some of the oops I've made. I'll post a screen shot if I'm still having problems as soon as the installation is complete.

                              Rod

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by mishhh, 05-25-2010, 08:54 AM
                              19 responses
                              6,189 views
                              0 likes
                              Last Post rene69851  
                              Started by gwenael, Today, 09:29 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post gwenael
                              by gwenael
                               
                              Started by Karado58, 11-26-2012, 02:57 PM
                              8 responses
                              14,830 views
                              0 likes
                              Last Post Option Whisperer  
                              Started by Option Whisperer, Today, 09:05 AM
                              0 responses
                              2 views
                              0 likes
                              Last Post Option Whisperer  
                              Started by cre8able, Yesterday, 01:16 PM
                              3 responses
                              11 views
                              0 likes
                              Last Post cre8able  
                              Working...
                              X