Thanks
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!
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
Remove an Input Question
Collapse
X
-
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?
ThanksTags: None
-
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
-
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 errorIndicator 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
-
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
-
-
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
-
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
-
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.
VTLast edited by VTtrader; 03-13-2012, 09:28 PM.
Comment
-
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
-
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
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by adeelshahzad, Today, 11:49 AM
|
2 responses
4 views
0 likes
|
Last Post
by adeelshahzad
Today, 12:15 PM
|
||
Started by spottysallrite, Today, 11:31 AM
|
1 response
6 views
0 likes
|
Last Post Today, 11:43 AM | ||
Started by johnMoss, 03-04-2024, 01:53 PM
|
2 responses
32 views
0 likes
|
Last Post
by Overnhou
Today, 11:21 AM
|
||
Started by Padan, Today, 02:02 AM
|
5 responses
17 views
0 likes
|
Last Post Today, 11:14 AM | ||
Started by Lele2k24, Yesterday, 11:24 AM
|
8 responses
29 views
0 likes
|
Last Post
by Lele2k24
Today, 11:00 AM
|
Comment