NexusFi: Find Your Edge


Home Menu

 





Reducing CPU load of NinjaTrader


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Fat Tails with 14 posts (17 thanks)
    2. looks_two aslan with 5 posts (5 thanks)
    3. looks_3 Big Mike with 3 posts (0 thanks)
    4. looks_4 Tarkus11 with 3 posts (2 thanks)
      Best Posters
    1. looks_one RJay with 3 thanks per post
    2. looks_two Fat Tails with 1.2 thanks per post
    3. looks_3 aslan with 1 thanks per post
    4. looks_4 Tarkus11 with 0.7 thanks per post
    1. trending_up 16,345 views
    2. thumb_up 29 thanks given
    3. group 7 followers
    1. forum 37 posts
    2. attach_file 3 attachments




 
Search this Thread

Reducing CPU load of NinjaTrader

  #11 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


cory View Post
if it calc on every tick use fitsttickofbar should show an improvement.

I need an indicator to update intrabar, so I cannot use "FirstTickOfBar". I have my chart set to a display update of 0.5 seconds. This means that the chart is updated 120 times per minute. It also means that all calculations performed by Plot() will beexecuted at most 120 times per minute.

During a news release ES is heavily traded, generating maybe 1000 ticks and more. The default setting for the display update prevents NinjaTrader from freezing under these conditions, and the chart can still be updated intrabar. This filtering is applied to Plot().

If I do not override Plot(), but use some of the Draw() methods in OnBarUpdate(), I do not know, whether these will be executed 1000 times per minute (unfiltered) or just 120 times according to the display update settings.

I want to use these methods intrabar, otherwise I would not have put the question here.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
 
  #12 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 625 since Jan 2010
Thanks Given: 356
Thanks Received: 1,127


Fat Tails View Post
If I use DrawRectangle() or DrawLine() or any of the other Draw() methods in OnBarUpdate(), will display update intervals as fixed via chart properties apply or will it be calculated with every incoming tick?

This is a good question for Ninja support. This could be an item that would trigger a refresh, regardless of the update interval.

Reply With Quote
Thanked by:
  #13 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103



aslan View Post
This is a good question for Ninja support. This could be an item that would trigger a refresh, regardless of the update interval.

If nobody knows it here, I will ask the question at Ninja support and come back.

Started this thread Reply With Quote
  #14 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 625 since Jan 2010
Thanks Given: 356
Thanks Received: 1,127

If the Draw() methods are causing your charts to update, then you can do similar caching/short cutting to only call it once in your indicators, or only when the anchor point changes.

Reply With Quote
  #15 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


aslan View Post
If the Draw() methods are causing your charts to update, then you can do similar caching/short cutting to only call it once in your indicators, or only when the anchor point changes.

Yes, that should be possible. But anyhow, try to understand how these Draw() methods work. I have one simple indicator which is supposed to run in CalcOnBarClose = false mode, and as I was lazy to write a custom plot I have employed the Draw() methods to achieve what I wanted.

Just want to know whether there is a risk that this indicator slows down NT.


Attached Thumbnails
Click image for larger version

Name:	YM 12-10 (5 Min)  02_12_2010.jpg
Views:	246
Size:	93.1 KB
ID:	26480  
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,465 since Jun 2009
Thanks Given: 33,242
Thanks Received: 101,665

Reducing CPU load and making more efficient indicators is an admirable goal, don't get me wrong --- but I think for any modern quad core CPU, there should be no issue.

With MultiCharts, even though I only trade CL, I have TF, ES, 6E, DX and YM loaded in the background. Each workspace has 5 charts (CL has 6). They are all running on what Ninja would call "COBC false" with a couple of indicators per chart.

My total CPU usage is about 3%. I see spikes to 10% every now and then, but rare. I have a i7 920 overclocked to 4ghz.



This machine is already two years old (well, 21 months). So really any quad core CPU bought in the last 4 years is probably more than fast enough to not worry about this per-tick stuff.

Mike



Join the free Markets Chat beta: one platform, all the trade rooms!

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
  #17 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


Big Mike View Post
Reducing CPU load and making more efficient indicators is an admirable goal, don't get me wrong --- but I think for any modern quad core CPU, there should be no issue.

Mike

You are funny. Not everybody has a quad core CPU, I don't. My equipment is three years old and has a dual core CPU. Also my questions were relating to NinjaTrader, not to MultiCharts.

CPU load for my default workspace typically oscillates between 20% and 40%. I have had no freezes and there are no problems, but I need to monitor CPU load. And everybody who runs NinjaTrader on equipment which is not the newest generation should as well.

RAM usage has gone down considerably with NT 7.0, but CPU load has increased, as they have optimized against it.

If there was no CPU problem, I would not have started this thread.




Started this thread Reply With Quote
  #18 (permalink)
 
trendisyourfriend's Avatar
 trendisyourfriend 
Quebec Canada
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG
Trading: ES, NQ, YM
Frequency: Daily
Duration: Minutes
Posts: 4,527 since Oct 2009
Thanks Given: 4,176
Thanks Received: 6,020

Fat maybe you could try cacheman to optimise your CPU usage.

Reply With Quote
  #19 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


trendisyourfriend View Post
Fat maybe you could try cacheman to optimise your CPU usage.

Cacheman will only help for memory/disk caching problems.
Some of @Fat Tails indicators needs a lot of data, so a lot of things to compute, memory or disk access time is not the problem, it's the CPU itself.
As NT multi-thread capabilities are not perfect, the easier solution is to use a fast CPU, having more than 4 cores won't help a lot, imho.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #20 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103



sam028 View Post
Cacheman will only help for memory/disk caching problems.
Some of @ Fat Tails indicators needs a lot of data, so a lot of things to compute, memory or disk access time is not the problem, it's the CPU itself.
As NT multi-thread capabilities are not perfect, the easier solution is to use a fast CPU, having more than 4 cores won't help a lot, imho.

It is not the amount of data that causes the problem. The FibonacciZones indicator, which uses a comparatively large data base, does not create any CPU load at all, because no calculations are performed with incoming ticks. Even with the bar close there is little excitement as recursive formulae are used and calculations are only performed if needed. There are two sources of CPU problems

(a) indicators that need to run in "CalcOnBarClose = False" mode

(b) extensive calculations that are being performed in Plot() also affect the indicators that run in "CalcOnBarClose= true" mode, I have had the case where the Plot() section of a single indicator caused a CPU load of about 30%.

Started this thread Reply With Quote
Thanked by:




Last Updated on November 8, 2011


© 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