Reducing CPU load of NinjaTrader - NinjaTrader Programming | futures io social day trading
futures io futures trading


Reducing CPU load of NinjaTrader
Updated: Views / Replies:8,848 / 37
Created: by Fat Tails Attachments:3

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
 3  
 
Thread Tools Search this Thread
 

Reducing CPU load of NinjaTrader

  #21 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary

Got this answer from Dierk who kindly responded to my question:


The Draw() methods create objects which are redrawn whenever a chart is repainted which is triggered by logic below. *)

Obviously the Draw() methods in your code would be called whenever OnBarUpdate() is triggered which could be down to the tick (COBC=false).


*) However, here is some info: IndicatorBase.Plot() call frequency is primarily impacted by the chart update frequency. Although there might be additional situations where the chart (and indicators) would require repainting.

As far as I have observed it is the repainting of the objects that consumes CPU power. If you cover a chart, it will not be repainted and the CPU load is quickly reduced.

Reply With Quote
The following 4 users say Thank You to Fat Tails for this post:
 
  #22 (permalink)
Elite Member
Milan Italy
 
Futures Experience: Intermediate
Platform: Ninjatrader, Sierra Chart
Favorite Futures: ES
 
Posts: 523 since Feb 2010
Thanks: 470 given, 629 received


Fat Tails View Post
As far as I have observed it is the repainting of the objects that consumes CPU power. If you cover a chart, it will not be repainted and the CPU load is quickly reduced.

Yes, that corresponds to my experience too. I minimize any chart I'm not looking at. You can experiment with all this using market replay, too.

Reply With Quote
The following user says Thank You to futuretrader for this post:
 
  #23 (permalink)
Elite Member
East Coast
 
Futures Experience: Beginner
Platform: Ninja
Favorite Futures: ES, NQ
 
Posts: 125 since Apr 2010
Thanks: 55 given, 81 received



Fat Tails View Post
Got this answer from Dierk who kindly responded to my question:


The Draw() methods create objects which are redrawn whenever a chart is repainted which is triggered by logic below. *)

Obviously the Draw() methods in your code would be called whenever OnBarUpdate() is triggered which could be down to the tick (COBC=false).


*) However, here is some info: IndicatorBase.Plot() call frequency is primarily impacted by the chart update frequency. Although there might be additional situations where the chart (and indicators) would require repainting.

As far as I have observed it is the repainting of the objects that consumes CPU power. If you cover a chart, it will not be repainted and the CPU load is quickly reduced.


Looking through some older posts - again, thanks for this!

I have removed most of the Draw statements from my indicators and what used to be big spikes in my 6-core 4.2Ghz CPU has calmed down even with news events.

While I like the aesthetics of clouds created with DrawRegion, it clearly created performance issues along with some other Draw commands.

Reply With Quote
The following 2 users say Thank You to Tarkus11 for this post:
 
  #24 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


Tarkus11 View Post
Looking through some older posts - again, thanks for this!

I have removed most of the Draw statements from my indicators and what used to be big spikes in my 6-core 4.2Ghz CPU has calmed down even with news events.

While I like the aesthetics of clouds created with DrawRegion, it clearly created performance issues along with some other Draw commands.

You can also limit the draw objects by using a lookback period from now and only draw them within that lookback period. You will then have them on today's chart, but not on the chart section a few days ago.

Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #25 (permalink)
Elite Member
East Coast
 
Futures Experience: Beginner
Platform: Ninja
Favorite Futures: ES, NQ
 
Posts: 125 since Apr 2010
Thanks: 55 given, 81 received

After observing this for a day and not having any "Not Responding" issues on the charts, I can say IMO this Draw issue is so severe that NT should include a warning on their use.

Fri was not as wild as Mon, and there were no big news announcements, but so far, so good...

In the past I have included some "cloud" coloring code in my indicators for aesthetics (and it also removes any visual ambiguity in a chart when sending an image of it), but the performance impact on live charts is horrendous.

So I now bracket that logic with a bool, so I can turn it on/off as a parameter. That way I can turn it on during off-time or when capturing an image, but leave it off while the chart is being updated.

Tweaking the efficiency of the Draw routines and the ability to use multi-cores during live updates is what I would put on the top of the "to do" list, but they probably are at NT anyway....

Reply With Quote
 
  #26 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


Tarkus11 View Post
After observing this for a day and not having any "Not Responding" issues on the charts, I can say IMO this Draw issue is so severe that NT should include a warning on their use.

Fri was not as wild as Mon, and there were no big news announcements, but so far, so good...

In the past I have included some "cloud" coloring code in my indicators for aesthetics (and it also removes any visual ambiguity in a chart when sending an image of it), but the performance impact on live charts is horrendous.

So I now bracket that logic with a bool, so I can turn it on/off as a parameter. That way I can turn it on during off-time or when capturing an image, but leave it off while the chart is being updated.

Tweaking the efficiency of the Draw routines and the ability to use multi-cores during live updates is what I would put on the top of the "to do" list, but they probably are at NT anyway....

If you use indicators, which draw clouds or colored channels, you should use them in setting CalculateOnBarClose = true. This should avoid a freeze.

I also use a bracket to a exclude the drawing of regions and rectangles. I do not have a separate Boolean, but use the opacity.. If it is set to 0, the part of the code with the Draw() methods is not executed, here an example from the TWAP V36

 
Code
if (Opacity1 != 0)
{
     DrawRegion("upper1"+ startBar, sessionBar-1, 0, UpperBand1, SessionTWAP, Color.Transparent, InnerAreaColor, Opacity1);
     DrawRegion("lower1"+ startBar, sessionBar-1, 0, SessionTWAP, LowerBand1, Color.Transparent, InnerAreaColor, Opacity1);
}

Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #27 (permalink)
Elite Member
etown,nc
 
Futures Experience: Intermediate
Platform: ninjatrader
Broker/Data: amp/zen
Favorite Futures: cl, es
 
Posts: 11 since Oct 2009
Thanks: 5 given, 1 received

Freezes

I had freeze/slow problems all week with the increased volume in 6e. I have a quad core, 3g mem... I reinstalled ninja, went to empty workspace and created a new chart and it was still slow. When I loaded up indicators on the chart it slowed up more. The cpu meter would max out on approx 25% when normally I have cpu usage of 3-6%.

Also the cursor would not respond quickly moving across the charts. Can't trade if you think you might be lagging the real time market.


No severe problems like this prior to this week. And all goes back to normal when volume drops off.. My computer guru buddy heard that there is a problem with quad cpu's and nt7. Anyone else have info on this?? I cut my processors down to 2 and now I get normal cpu spikes above 25%. That was late day on Friday so I'll have to wait until Monday to see if it works

Other suggestions I have read on blogs today: update video drivers, delete old version of .net, repair database, delete mdb.....

Reply With Quote
 
  #28 (permalink)
Elite Member
East Coast
 
Futures Experience: Beginner
Platform: Ninja
Favorite Futures: ES, NQ
 
Posts: 125 since Apr 2010
Thanks: 55 given, 81 received


gkinlaw View Post
I had freeze/slow problems all week with the increased volume in 6e. I have a quad core, 3g mem... I reinstalled ninja, went to empty workspace and created a new chart and it was still slow. When I loaded up indicators on the chart it slowed up more. The cpu meter would max out on approx 25% when normally I have cpu usage of 3-6%.

Also the cursor would not respond quickly moving across the charts. Can't trade if you think you might be lagging the real time market.


No severe problems like this prior to this week. And all goes back to normal when volume drops off.. My computer guru buddy heard that there is a problem with quad cpu's and nt7. Anyone else have info on this?? I cut my processors down to 2 and now I get normal cpu spikes above 25%. That was late day on Friday so I'll have to wait until Monday to see if it works

Other suggestions I have read on blogs today: update video drivers, delete old version of .net, repair database, delete mdb.....


You should be able to test before Monday by using replay data under File/Download Replay Data...

I have a 6-core CPU but NT single-threads live charts anyway. Since turbo-mode of the chip can boost 3 cores to 4.2Ghz for those type of apps, I force NT to use the faster cores by setting the startup property of my NT-64bit icon (got this from a user on the NT forum)

C:\Windows\System32\cmd.exe /C start "NinjaTrader 7" /HIGH /AFFINITY 0x7 "C:\Program Files (x86)\NinjaTrader 7\bin64\NinjaTrader.exe"

This sets NT to High Priority and the Affinity to use the 1st 3 cores (doesn't matter which one since all 3 are turbo-boosted).

If your indicators use a lot of Draws you might want to exclude them if you can. Also try the suggestion of minimizing to the Taskbar charts you don't constantly watch to lighten the re-draws that the CPU has to perform.

I am not sure if NT is offloading screen updates to the GPU using WPF - I have a decent video card (not great, but good enough) and I would hope it is being used to take some stress off the CPU.....

EDIT:

I guess not

http://www.ninjatrader.com/support/forum/showthread.php?t=11898

Will NT 7's charts be based on Windows Presentation Foundation (WPF) or WinForms?

It will be based on WinForms.

Reply With Quote
 
  #29 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,352 given, 83,231 received


gkinlaw View Post
Ihe cpu meter would max out on approx 25%

If you have a quad core CPU, then this indicates NinjaTrader's single-threaded design is the culprit. For charting, NinjaTrader can only use one CPU thread at a time, last time I checked.

Usually this is due to an indicator. If you run NinjaTrader with no indicators, you shouldn't see this problem.

Mike

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.

Reply With Quote
 
  #30 (permalink)
Elite Member
etown,nc
 
Futures Experience: Intermediate
Platform: ninjatrader
Broker/Data: amp/zen
Favorite Futures: cl, es
 
Posts: 11 since Oct 2009
Thanks: 5 given, 1 received

CPU



Big Mike View Post
If you have a quad core CPU, then this indicates NinjaTrader's single-threaded design is the culprit. For charting, NinjaTrader can only use one CPU thread at a time, last time I checked.

Usually this is due to an indicator. If you run NinjaTrader with no indicators, you shouldn't see this problem.

Mike

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Here's an image of the task mgr with 2 cpu's running, I get spike's now instead of capping off at 25%. Also yesterday I found that I was recording data in Jan 1. and I cut that off. Bet that used up some cpu.

thanks for you replies!!

Reply With Quote

Reply



futures io > > > > > Reducing CPU load of NinjaTrader

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
Am looking for ELCollections.dll that has been modified for multi-threaded cpu's. sigmatrader EasyLanguage Programming 2 August 12th, 2011 06:02 PM
SEC Reducing Market Volitility tdaman News and Current Events 0 April 6th, 2011 03:32 AM
NT 7 & Multicore CPU max-td NinjaTrader 19 January 27th, 2011 07:30 AM
Slippage - need advice on reducing it jackyd Traders Hideout 7 July 6th, 2009 03:24 AM


All times are GMT -4. The time now is 04:25 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.66 seconds with 20 queries on phoenix via your IP 54.91.38.173