Now before I go on, let me state that this post is FYI only; I do not have the time to answer questions about the installation or usage of the CLR debugger. However, I think this is important enough information for the NinjaTrader community that I decided to take the time to post.
To setup and use the Microsoft CLR debugger with NinjaTrader:
1. Download and install the .Net Framework v2.0 SDK:
2. Run the CLR debugger (the install will setup a link through "All Programs" under your Windows Start button)
3. In NinjaTrader, open an indicator or strategy to debug, right click, and select Debug Mode. Compile the NinjaTrader code. You'll get a message about Debug mode, simply hit Ok to continue.
4. In the CLR Debugger use File->Open->File... and open the .cs source file for the strategy or indicator you compiled in step 3. The default location for an indicator source file is: C:\Documents and Settings\<your username>\My Documents\NinjaTrader 6.5\bin\Custom\Indicator. The strategies are under the same path except ..\Custom\Strategy.
5. In the CLR Debugger under the Debug menu, select "Attach to Process...". Scroll down and highlight NinjaTrader.exe. Press the Attach button. Close the window.
6. In the CLR Debugger, find a good place for a breakpoint in your source file which should already be open from step 4 and press F9 to set a breakpoint. If the breakpoint dot is not solid, go back to NinjaTrader and compile the source file again and then return to the CLR Debugger. The CLR Debugger should recognize that the source file has changed and ask to reload it. Press Yes to All. By this point, the breakpoint should be a solid dot and ready to go.
7. Now use NinjaTrader as you normally would to execute your strategy or indicator. Once the break point in the CLR debugger is hit, execution will stop and you'll have access to the debugging environment.
This is a pretty good and much cheaper alternative than using the full blown Visual Studio for debugging. I hope you find the CLR debugger as useful as I do.
Regards,
David
dbw451
Comment