I have a simple class called TestClass that has an empty constructor and one simple public method that returns a string: GetColor(). That's it. I compile the thing using SharpDevelop, copy the DLL to ...\My Documents\NinjaTrader 7\bin\Custom, then run NinjaTrader and edit my very simple test indicator. I add the reference via the References dialog and add the using statement to include the namespace (MyTest). In the OnStartUp event handler, I create an instance and call GetColor to store the color in a string instance variable. All that seems straight forward, but I'm obviously missing something. Restarting Ninja does not help.
The code terminates (does not generate an exception, just terminates) when it gets to the line that creates the instance. If I comment out all the lines referring to the included class, it runs fine. Once I uncomment the line that creates the class, it just terminates when it runs in the chart window. (The code that uses this simple test paints the color of the bars. The test class returns "Blue" and the default color is "Red". With the above mentioned lines commented out, the bars paint Red. Otherwise Gray. I put a MessageBox.Show("OnStartUp") in the OnStartUp handler just before the creation of the TestClass, and it does not display when the line is uncommented. Everything compiles fine, although intellisense does not work for the TestClass. It seems like the runtime is not seeing the referenced class as it builds something. I am obviously missing something!)
Is there a reference somewhere that explains in detail what you need to do to create an assembly that plugs into NinjaTrader for use from custom NanjaScript indicators and strategies?
Any help you can offer is greatly appreciated!
Thanks
Comment