Debug Strategies and Indicators with the MicroSoft CLR Debugger - NinjaTrader Programming | futures io social day trading
futures io futures trading


Debug Strategies and Indicators with the MicroSoft CLR Debugger
Updated: Views / Replies:8,461 / 6
Created: by sam028 Attachments:2

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Debug Strategies and Indicators with the MicroSoft CLR Debugger

  #1 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,366 since Jun 2009
Thanks: 3,573 given, 3,982 received

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:

http://www.microsoft.com/downloads/d...displaylang=en

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


Success requires no deodorant! (Sun Tzu)

Last edited by sam028; February 4th, 2010 at 02:03 PM. Reason: add .exe name
Reply With Quote
The following 17 users say Thank You to sam028 for this post:
 
  #2 (permalink)
Elite Member
canada
 
Futures Experience: Intermediate
Platform: Ninjatrader
 
qewcool's Avatar
 
Posts: 44 since Apr 2010
Thanks: 25 given, 14 received

Thanks for this
Is there a comparable procedure for use with VS2008 ?

========================================

Actually found a procedure in the NT help guide for VS2005. Guess should be the same steps for VS2008.

http://www.ninjatrader-support.com/HelpGuideV6/helpguide.html?VisualStudio

Reply With Quote
 
  #3 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received

CLR Debugger wont


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 ...

Thanks for any feedback!
Jon

Attached Thumbnails
Debug Strategies and Indicators with the MicroSoft CLR Debugger-errorclr.jpg  

Last edited by Trader.Jon; December 4th, 2010 at 10:26 PM. Reason: new info
Reply With Quote
 
  #4 (permalink)
Elite Member
Bala, PA, USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Mirus, IB
Favorite Futures: SPY, Oil, Euro
 
monpere's Avatar
 
Posts: 1,858 since Jul 2010
Thanks: 300 given, 3,276 received


Trader.Jon View Post
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 ...

Thanks for any feedback!
Jon

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.

Reply With Quote
The following user says Thank You to monpere for this post:
 
  #5 (permalink)
NinjaTrader Trader
Kitchener, Ontario, Canada
 
Futures Experience: Advanced
Platform: NinjaTrader, Tradestation
Broker/Data: Interactive Brokers
Favorite Futures: Stocks
 
Posts: 6 since Feb 2012
Thanks: 2 given, 0 received


monpere View Post
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.

I have downloaded Windows 7 x64 SDK kit and I don't see any CLR debugger. I figured this was going to be there.

What should I do? Uninstall this and install SDK for .NET 2 ? When I did that, it did install but there was not executable for CLRDebugger

Please advise.

Reply With Quote
 
  #6 (permalink)
Elite Member
Taylorsville
 
Futures Experience: None
Platform: NinjaTrader
Favorite Futures: I'm a newbie I don't know yet but futures seem good
 
Posts: 3 since Mar 2012
Thanks: 12 given, 6 received

Use Sharp Develop

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.

Hope this helps

~M

Reply With Quote
The following 5 users say Thank You to neilsomi for this post:
 
  #7 (permalink)
Elite Member
Chicago, IL United States
 
Futures Experience: Advanced
Platform: Ninja Trader, Trader Work Station, Think or Swim
Broker/Data: Ninja Trader, Interactive Brokers, TD Ameritrade
Favorite Futures: ES
 
Posts: 27 since Nov 2014
Thanks: 7 given, 8 received

Trying to fix last few compile errors - ) expected... Help please!

Hi there,

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(v=vs.120).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; {




Thanks,
Jeff

Attached Thumbnails
Debug Strategies and Indicators with the MicroSoft CLR Debugger-recent-2015-02-17_1626.png  

Last edited by Trader Jeff; February 17th, 2015 at 07:16 PM. Reason: Content Change, Added the code from line 46.
Reply With Quote

Reply



futures io > > > > > Debug Strategies and Indicators with the MicroSoft CLR Debugger

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft is Spying on Me Fat Tails Tech Support 48 September 23rd, 2013 05:40 PM
Microsoft Close to Deal for Skype Quick Summary News and Current Events 0 May 10th, 2011 12:50 AM
how to download indicators and strategies manny1 NinjaTrader 10 January 3rd, 2011 01:20 PM
Division by Zero, how to debug arjfca EasyLanguage Programming 6 September 30th, 2010 11:04 AM
Microsoft Earnings and Revenue Rise, Top Forecasts Quick Summary News and Current Events 0 July 22nd, 2010 05:50 PM


All times are GMT -4. The time now is 12:18 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-14 in 0.12 seconds with 20 queries on phoenix via your IP 54.221.93.187