NexusFi: Find Your Edge


Home Menu

 





Anyone have any hints for optimizing C# code?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Zondor with 20 posts (21 thanks)
    2. looks_two ZTR with 13 posts (0 thanks)
    3. looks_3 Richard with 11 posts (20 thanks)
    4. looks_4 gomi with 7 posts (15 thanks)
      Best Posters
    1. looks_one Fat Tails with 2.6 thanks per post
    2. looks_two gomi with 2.1 thanks per post
    3. looks_3 Richard with 1.8 thanks per post
    4. looks_4 Zondor with 1.1 thanks per post
    1. trending_up 48,481 views
    2. thumb_up 108 thanks given
    3. group 39 followers
    1. forum 111 posts
    2. attach_file 13 attachments




 
Search this Thread

Anyone have any hints for optimizing C# code?

  #11 (permalink)
 
ZTR's Avatar
 ZTR 
 
Experience: Advanced
Platform: NinjaTrader7
Broker: Mirus RCG/Zen-Fire
Trading: CL & 6e, looking at ES, ZB and AU again.
Posts: 2,096 since Nov 2009
Thanks Given: 1,099
Thanks Received: 1,393

NetTecture,

When is you package coming out?

I'm going to look at Equtec, ScoobyStoo,

Downloaded it last night, but it might be a while before I actually get to optimizing Zondor's & I's indy's

R.I.P. Andy Zektzer (ZTR), 1960-2010.
Please visit this thread for more information.
Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
REcommedations for programming help
Sierra Chart
Trade idea based off three indicators.
Traders Hideout
Increase in trading performance by 75%
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
36 thanks
Tao te Trade: way of the WLD
24 thanks
Spoo-nalysis ES e-mini futures S&P 500
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #12 (permalink)
 NetTecture 
Szczecin
 
Experience: Intermediate
Platform: Ninja, writing own now
Posts: 211 since Mar 2010

No idea. Some months maybe. SO far the goal is to have something that I can use for trade control and some visualization. It was on a backburner for some months, not it goes in full speed again. Working fulltime on it. I hope to put out a usable internal version of WHATEVER FUNCTIONALITY I CAN GET mid of next week. Working on the client/server part now (news: this is not ninja - it will be a client server tool running against a real sql server as data store, allowing multiple users to connect - the idea is something that has the power of ninja and is also usable in a prop shop style of environment).

Reply With Quote
  #13 (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,440 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,599


Good advice here.

[soap box on]

But let me also say, you are likely to see a better improvement in overall performance by just eliminating all the crap people fall for on Windows installs.

Don't install all the registry cleaning crap, all the fancy program uninstallers, all the extra special haxx0r stuff that promises to increase speed. All this stuff is loaded down bloatware, worse even a lot of it is spyware.

Latency is a big issue for trading systems. So if you are really looking for performance, you need to run a wired connection (not wifi), make sure you aren't playing any internet music or downloading torrents, etc.

Personally, I don't install the crap people fall for, but I don't worry so much about the latency side on the internet connection. If I can only be successful trader by entering a trade 250ms faster, then I am not a good trader.

Also, let me state the obvious --- it seems many people have really old computers. If you don't have a quad core CPU, it is old. You can't get blood from a turnip, and you can't make an out of date computer fast. You should buy a new system. If you don't build it yourself, then the first thing you should do when you get the system is blow away everything and reformat the partition, reinstall your OS from scratch. Most tier 1/2/3 system manufacturers load up their installs with crap, crap and more crap because people that don't know any better just can't get enough crap!



[/soap box off]

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:
  #14 (permalink)
 NetTecture 
Szczecin
 
Experience: Intermediate
Platform: Ninja, writing own now
Posts: 211 since Mar 2010

Amen to that. Seriously. It is called "Crapware" for a reason. I love our company internal Widows installs - yes, it is not bare bone (office etc.), but no - no damn crapware on it

And I TRADE from a pure windows virtual machine sitting in a data center I Dont trust neither my office power supply nore my internet connection

Reply With Quote
  #15 (permalink)
 
ZTR's Avatar
 ZTR 
 
Experience: Advanced
Platform: NinjaTrader7
Broker: Mirus RCG/Zen-Fire
Trading: CL & 6e, looking at ES, ZB and AU again.
Posts: 2,096 since Nov 2009
Thanks Given: 1,099
Thanks Received: 1,393

Recently purchased a system built around an Intel i7 Quad Core Processor 860, 2.80GHz, 1333 MHz clock speed memory with RAID 1 & Nvidia Quadpro 450

Guaranteed to come with nothing but Windows 7 pro.

Will be using my old system in Global Simulation mode for testing/
development of indicators and strategies, and as a backup Gom & Zondor recorder.


R.I.P. Andy Zektzer (ZTR), 1960-2010.
Please visit this thread for more information.
Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #16 (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,440 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,599

Very nice, enjoy the new system

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:
  #17 (permalink)
 YuvalW 
USA
 
Experience: Beginner
Platform: NinjaTrader
Posts: 26 since Jul 2009
Thanks Given: 4
Thanks Received: 17


NetTecture View Post
... My only concern would be that all Ninja code is heavily crypted to make decompiling impossible (most likely to stop people from posting emabarassing bad code samples?). I am not sure how wel lthat will run together with a profiler. It SHOULD - as the resulting classes etc. still have to be legal in the .NET framework - but they may be hard to read, confusing and possibly crash something in the profiler.

Ninja's assemblies are not encrypted just don't have the IL in them, RemoteSoft protector takes the IL out but LEAVES the metadata, so basically he should have no problem seeing how much time each method in ninja took.

Also, I wouldn't bash WinForms so much, it is true the msft put their efforts on WPF but still WinForms is a good thing. Ninja, for saving development time, uses Infragistics UI controls which are cool, but with "cool" may come overkill and performance issues (not saying anything bad about Infragistics, they have great controls, but might be misused).

If I understood correctly ZTrade is talking about indicators that has heavy(?) I/O to disk, I guess that it might take some time to read a file full of ticks, not talking about the recording.

Reply With Quote
  #18 (permalink)
 
ZTR's Avatar
 ZTR 
 
Experience: Advanced
Platform: NinjaTrader7
Broker: Mirus RCG/Zen-Fire
Trading: CL & 6e, looking at ES, ZB and AU again.
Posts: 2,096 since Nov 2009
Thanks Given: 1,099
Thanks Received: 1,393

It was suggested by one the the Ninja_Traders that code optimizations was necessary, I asked how? This is what I was told by another:

If you want someone to professionally evaluate your code and make recommendations you could try one of the 3rd party NinjaScript Consultants here: Online Trading. [AUTOLINK]NINJATRADER[/AUTOLINK]. NinjaScript Consultants. They make a business out of programming scripts for people and if you ask some of them they can provide you with code evaluations too.


The recording indicators can cause long load times - Especially earlier versions of BuySellVolume.

Wanted to find some way to understand what was happening and avoid duplication of effort. Any time something is changed another long wait is required, as the data must be reloaded from disk.

Zondor has added some clean up code but load times are still very, very long. I'll let him explain that part, but it is basically lifted from the indicators that Ninja Trader has built in.

R.I.P. Andy Zektzer (ZTR), 1960-2010.
Please visit this thread for more information.
Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #19 (permalink)
 NetTecture 
Szczecin
 
Experience: Intermediate
Platform: Ninja, writing own now
Posts: 211 since Mar 2010


YuvalW View Post
Ninja's assemblies are not encrypted just don't have the IL in them, RemoteSoft protector takes the IL out but LEAVES the metadata, so basically he should have no problem seeing how much time each method in ninja took.

Also, I wouldn't bash WinForms so much, it is true the msft put their efforts on WPF but still WinForms is a good thing. Ninja, for saving development time, uses Infragistics UI controls which are cool, but with "cool" may come overkill and performance issues (not saying anything bad about Infragistics, they have great controls, but might be misused).

If I understood correctly ZTrade is talking about indicators that has heavy(?) I/O to disk, I guess that it might take some time to read a file full of ticks, not talking about the recording.

Well...
* RemoteSoft protector. Interesting. This, though, seriously sucks - with all respect for the attempts of RemoteSoft, I dont see them coming up with efficient assembly level optimizations. Ouch.
* NinjaTrader6.5 does NOT use Infragistics, and the 7.0 uses such an outdated version I dont wonder they have performance problems - a lot of performance optimizations was done recently by infragistics. Their version is ancient (makes me wonder whether they care at all about bugfixes etc.). Add that to the usual "program quality focus" we all know from Ninja and "crapware" gets a ninja meaning Seriously - never seen a program with so many brain dead decisions. Just to make things true- the version they use is like 2 years old (8.3, now we are at 10.1). Thhe 9 version had a lot of UI optimizations, especially in grids etc.
* Winforms - sorry, winforms DESERVES A bashing for charting etc. It simply is not modern enough. MS has put up a tremendous amount of groundwork towards being able to offload higher functions to the GPU - which really will shine when you have lot of interactive updates (I.e. real time charts). Even text rendering is now part of a DirectX method call - instead of the CPU working. The performane gains are pretty fantastic. NO way to get that out of Winforms. Espeicalyl the new 4.0 version (why the heck will NinjaTrader 7 not be .NET 4.0? I moved my own code over within days) with the cache hinting that allows arbitrary elements to be GPU-cached is REALLY a godsent. I could se a ton of really nice stuff one could do with charts to allow more control

IO indicators are always an issue - file IO is not that simple. If you do a lot of reading and writing, try using BufferedStreams around the files - with a buffer good enough to actually be relevant (2-4mb maybe). After that, a better disc subsystem is needed

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



NetTecture View Post
On my own T&S implemntation I actually manage to offload a lot of stuff onto the GPU and avoid redrawing the text - without any written code. WPF just is SO much more powerfull

I started to develop a visualization app for trading with WPF but quickly went back to GDI because it was impossible to draw a 1 pixel width line (the whole "dpi independant" paradigm...", and fonts were blurry. I think now you can draw 1 pixel lines, but aren't fonts still blurry ?

Reply With Quote




Last Updated on December 24, 2015


© 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