How to check your code using Visual Studio and FxCop
On the .net platform there are code analysis stuff that help you to find errors in code. Most well-known is FxCop
To use them, first you must build a projet using Visual Studio. EDIT : Actually it's not true : you can run FxCop without using VS : see post #4
For that, create a new project, type dll, target .Net 3.0 for NT6.5, and target .Net 3.5 for NT7.
Then basically you need to add references to NinjaTrader.Core and WilsonOrMApper (in NT binaries folder). (cf picture)
Then add the indicator files, using "Add as Link" (cf Picture).
You must add
@ADX and @Indicator(Indicator folder),
@Column(Market Analyzer folder)
@and Strategy (Strategy Analyzer)
Then you can compile your project as dll.
You can make changes to the source, they will be done on the NT file as well because of the link.
If you are using a high version of VS2010, code analysis tools are included in Analyze menu.
Results are shown in the IDE : it's clear I forgot to Dipose of a Font object. (see Picture)
If you do not have an included code analyzer in the VS you use, you can use the FxCop tool free from MS : in Fxcop Open the dll (Add Targets... from the menu) you just created, and tada, from here too I can see I forgot the Font disposal.
Hope it might help someone.
Last edited by gomi; May 13th, 2010 at 09:20 AM.
The following 11 users say Thank You to gomi for this post:
Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.
Need help? 1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first. 2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses. 3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make. 4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance. 5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers. 6) Help using the forum? Watch this video to learn general tips on using the site.
If you want to support our community, become an Elite Member.
I've just been reading mostly and trying to understand it a bit more... can you please answer a question or two when you have the time, or anyone...thanks in advance
I would like to know what might be the least intrusive or demanding form of communication to get at raw data, is it possible to use only part or less of NT and get results for some things? I am trying to figure out how to use a lot more data and less stuff , but not really sure what I am looking for... I read some of the different languages , just the basics , I want something simple and fast like dde but the way it is supposed to be so that everything works together smoothly and still have plenty of room for other things as well to build on as I learn and have it all work together...
"Successful trading is one long journey, not a destination" Peter Borish Former Head of Research for Paul Tudor Jones speaking on conversations with John F. Carter