Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Debug Strategies and Indicators with the MicroSoft CLR Debugger
It's from NT official forum, posted by dbw451 (thx to him).
Very useful when simple debug procedure (Print"..." have failed).
This is describing how to debug strat/indic with CLR debugger (C:\Program Files (x86)\Microsoft.NET\SDK\v2.0\GuiDebug\DbgCLR.exe).
Tip
I didn't see any information in this forum about using Microsoft's CLR Debugger with NinjaTrader. Since NinjaTrader v6.5 is a .Net Framework 2.0 application, strategies and indicators can be debugged using Microsoft's CLR Debugger which included in the free .Net Framework 2.0 SDK. The CLR debugger is a sub-set of the Visual Studio debugger. It is useful because you can set breakpoints, look at variable values, and explore classes.
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.
Is there a recommendation on how to use CLR in NT7 / Win7 environment ... or WinDBG ??
I am trying the CLR Debugger but cannot get past the error that it cannot automatically select the type of code.
[edit] I did a repair of the SDK install and it is working ... still would appreciate feedback from a person with experience:
The strategy normally only takes a minute to run backtest on the data/dates I am using, but its been 20 minutes since the last entry in the 'modules' of CLR and still have the 'busy' running on NT7 .. sadly no F1 help available in CLR to offer assist .. I have a red circle with a yellow arrow (still) where I selected the breakout point in the debugger ... specifically what should I be seeing?
[edit2] OK, installed VS2008 on trial and at least I managed to get the debugger and NT to exist togeter ... no exception error in the NT log tab yet (2 hours after starting the 1 minute backtest) and zero entries in the VS2008 error list panel ... maybe I'll start a new thread later after I read the dummies book ...
I used the CLR debugger with NT6.5 and now, currently use it with NT7 on Windows Vista with no problems. Did not have to change anything for it to work with NT7.
Trading: I'm a newbie I don't know yet but futures seem good
Posts: 3 since Mar 2012
Thanks Given: 17
Thanks Received: 6
I just started using SharpDevelop (its free). Its my first post so I can't post links but you can google Sharp Develop.
Here are the steps:
NinjaTrader
* Open up your strategy for editing in NinjaTrader.
* Right click on the edit window and choose Debug Mode
* Compile your strategy, it should have a popup warning you are in Debug Mode
--- Note: Sharp Develop won't hit break points unless your strategy was compiled in Debug Mode. ---
Sharp Develop
* Create a new Solution - File->New Solution->SharpDevelop->Empty Solution
* Add your strategy file (.cs) to it. Right Click on your Solution in the Projects Pane->Add Item
* Attach Sharp Develop to the NinjaTrader Process - Debug->Attach to Process
* Add break points - put the cursor on a line you want a break point and press F7, or click on the column left of the line numbers.
Run your strategy in the Strategy Analyzer and it will stop at the breakpoints you've specified. You can add watches, view variable contents etc.
I am trying to repair the last of a bunch of compile errors on a Slope indicator in order to use it for a strategy. The last few are: ) expected & ) expected.
I realize it could be due to placing a statement vs. expression but I am not sure how to correct it. Any help would be appreciated. https://msdn.microsoft.com/en-us/library/tc5zwdf7.aspx The line is on the error code CS1026.
In the chance anyone can help, I am attaching Line 46 - where the errors are occurring:
Line 46: if (CrossAbove(MASlopeMulti(BackgroundColorType283.BySlope, 3, 3, 1, 1, 255, Color [Red], Color [DarkRed], Color [Black], Color [Orange], 150, Color [Orange], 3, 3, 10, 10, 0, 0, 3, 8, 20, 20, 13, SlopeMA1Type283.SMA, 13, SlopeMA2Type283.None, -15, MALineColorType283.BySlope, MALineDashStyleType283.BySlope, MALineDashStyle283.Solid, MALineDashStyle283.Solid, MALineDashStyle283.Solid, 4, 4, 4, MALineWidthType283.BySlope, MAPriceTypes283.Open, 15, Color [Black], PaintBarTrendType283.RisingFallingOnly, PaintBarType283.BySlope, Color [Red], Color [Transparent], 35, Color [Green], Color [Blue], Color [Black], true, 1, Color [DarkRed], Color [Blue], Color [ForestGreen], DisplaySlopeLocation283.BottomRight, SlopePrecisionType283.None, SLRType283.Fast, SlopeTagText283.Auto;"[Font{"; Name=Arial; Size=13; Units= 3; GdiCharSet=1; GdiVerticalFont=False; 2; 3; 3; 3; 3; 0.7; 0.7; 255; Color [LightGreen]; UserSlopeTextLocation283.Right; 9; 9;SlopeValue; KAMASlowPeriod; 1; {