PDA

View Full Version : Copy an Indicator


Lambo
09-05-2008, 05:42 AM
I've got an indicator that is running as designed. I'd like to make a copy of it, change the name, and make some minor modifications to create a new indicator. I can't seem to figure out how to do that. Can anyone help?

Thanks,
Paul

NinjaTrader_Josh
09-05-2008, 08:45 AM
Hi Lambo,

Open up the indicator in the NinjaScript Editor. Right click and then click "Save As". Type in a new name and it will make a new copy.

Lambo
09-05-2008, 02:23 PM
When I do that and change all instances of the old name to the new name in the code and then compile, I get an error "The namespace NinjaTrader Indicator" already contains a definition for "Old Indicator Name".

code CS0101

Thanks,
Lambo

NinjaTrader_Josh
09-05-2008, 02:27 PM
You don't need to manually change anything. Just right click->Save As. Type in a new name and then everything is done.

Lambo
09-05-2008, 04:27 PM
It doesn't work. I get the error message. I just don't know how to proceed now.

NinjaTrader_Josh
09-05-2008, 04:36 PM
You got to delete that old one. Name it a different name now. You cant have multiple indicators with the same name.

Lambo
09-07-2008, 12:45 PM
Josh, I don't think you understand. First of all I copied the original one and changed the name to a new indicator. I edited out all the old references and changed them to the new indicator name. There should have been nothing left of the old indicator in the new one. The whole idea was to keep the old indicator and creating an entirely new one, which I believe I did.

However, I get that irritating error message which makes no sense.

Paul

NinjaTrader_Josh
09-07-2008, 01:05 PM
Paul,

The error means you have 2 definitions for the same name. You need to remove one of them before it will compile. Do this. Delete your "new indicator". Hit F5 to Compile. Your old indicator should have no problem compiling. Then open your old indicator and right click -> save as. Type in a new name. Do NOT edit anything. Just hit F5 to compile now. You do not need to change anything in your indicator to create a new copy.

If you still have difficulties you can send me both the old and the new indicators to my email and I will take a look in fixing it up for you. I suspect it may be something you edit that may be causing conflicts.

josh.peng [at] ninjatrader (dot] com.

Lambo
09-07-2008, 02:07 PM
Josh, I found the problem. Evidently copies of the original indicator were still in the NT directories. I got rid of all of them except for one which was stashed in ...\NinjaTrader 6.5\bin\Custom. I then went back and compiled the new indicator and it finally worked. The error message it was giving me had nothing to do with what I was currently compiling, but instead was stating that it was unhappy that there was an unresolved problem elsewhere. That doesn't seem very intuitive to me. Oh well, I'm glad I finally got it to work.

Thanks for your help and patience,

Paul

NinjaTrader_Josh
09-07-2008, 02:41 PM
Paul,

Great! Glad you got it fixed. Basically NinjaTrader needs all NinjaScript files to be free of error before it can compile.