How to check your code using Visual Studio and FxCop - futures io
futures io futures trading



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 Big Mike with 1 posts (1 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 GridKing with 1 posts (1 thanks)
    1. trending_up 9,360 views
    2. thumb_up 21 thanks given
    3. group 7 followers
    1. forum 4 posts
    2. attach_file 4 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

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

 
Search this Thread
 

How to check your code using Visual Studio and FxCop

(login for full post details)
  #1 (permalink)
Market Wizard
Paris
 
Experience: None
Platform: NinjaTrader
 
Posts: 1,247 since Oct 2009
Thanks: 272 given, 4,415 received

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:	453
Size:	32.0 KB
ID:	13276   Click image for larger version

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

Name:	fxcop.png
Views:	388
Size:	71.3 KB
ID:	13278  
Started this thread Reply With Quote
The following 12 users say Thank You to gomi for this post:

 
Best Threads (Most Thanked)
in the last 7 days on futures io
Battlestations: Show us your trading desks!
111 thanks
Selling Options on Futures?
109 thanks
Rank your Futures vs Stocks trading priority
37 thanks
Want your NinjaTrader indicator created, free?
26 thanks
Bitcoin storage wallet recommendations
18 thanks
 
(login for full post details)
  #3 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,785 since Jun 2009
Thanks: 32,314 given, 97,575 received


Thx Gomi, this is now a sticky.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:
 
(login for full post details)
  #4 (permalink)
Market Wizard
Paris
 
Experience: None
Platform: NinjaTrader
 
Posts: 1,247 since Oct 2009
Thanks: 272 given, 4,415 received

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:	303
Size:	88.2 KB
ID:	13315  
Started this thread Reply With Quote
The following 7 users say Thank You to gomi for this post:
 
(login for full post details)
  #5 (permalink)
San Diego, CA USA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES
 
GridKing's Avatar
 
Posts: 3,650 since May 2011
Thanks: 584 given, 881 received

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 futures io Trade Journal Reply With Quote
The following user says Thank You to GridKing for this post:


futures io Trading Community Platforms and Indicators NinjaTrader > How to check your code using Visual Studio and FxCop


Last Updated on July 17, 2012


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 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