NexusFi: Find Your Edge


Home Menu

 





How to check your code using Visual Studio and FxCop


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one gomi with 2 posts (19 thanks)
    2. looks_two GridKing with 1 posts (1 thanks)
    3. looks_3 Big Mike with 1 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 10,145 views
    2. thumb_up 21 thanks given
    3. group 7 followers
    1. forum 4 posts
    2. attach_file 4 attachments




 
Search this Thread

How to check your code using Visual Studio and FxCop

  #1 (permalink)
 gomi 
Paris
Market Wizard
 
Experience: None
Platform: NinjaTrader
Posts: 1,270 since Oct 2009
Thanks Given: 282
Thanks Received: 4,505

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
  • your indicators,
  • @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.

Attached Thumbnails
Click image for larger version

Name:	addaslink.png
Views:	583
Size:	32.0 KB
ID:	13276   Click image for larger version

Name:	VS2010.png
Views:	559
Size:	99.5 KB
ID:	13277   Click image for larger version

Name:	fxcop.png
Views:	525
Size:	71.3 KB
ID:	13278  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
NexusFi Journal Challenge - April 2024
Feedback and Announcements
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
need some ninjascript help
Traders Hideout
 

  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,392 since Jun 2009
Thanks Given: 33,170
Thanks Received: 101,530


Thx Gomi, this is now a sticky.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
 gomi 
Paris
Market Wizard
 
Experience: None
Platform: NinjaTrader
Posts: 1,270 since Oct 2009
Thanks Given: 282
Thanks Received: 4,505

Thks Mike. Actually it occured to me that you don't need Visual Studio at all to use FxCop.

Just open FxCop, Add Target... the NinjaTrader.Custom.dll which is the dll NT builds when it compiles. It's located in MyDocuments/NinjaTrader/bin/Custom folder.

It will ask to locate the NT Core dll, which is in Program Files/NinjaTrader/bin folder

Then run Analyze : all the Indicators are run through FxCop (see pic)

Attached Thumbnails
Click image for larger version

Name:	fxcop2.png
Views:	446
Size:	88.2 KB
ID:	13315  
Started this thread Reply With Quote
  #5 (permalink)
 
GridKing's Avatar
 GridKing 
San Diego, CA USA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES
Posts: 3,630 since May 2011
Thanks Given: 584
Thanks Received: 881

Thanks @gomi again!

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

Thanks

"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
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:





Last Updated on July 17, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts