NexusFi: Find Your Edge


Home Menu

 





Indicator performance bottleneck


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Adamus with 8 posts (1 thanks)
    2. looks_two ratfink with 6 posts (3 thanks)
    3. looks_3 cory with 5 posts (3 thanks)
    4. looks_4 Tasker_182 with 2 posts (0 thanks)
      Best Posters
    1. looks_one Zondor with 1 thanks per post
    2. looks_two cory with 0.6 thanks per post
    3. looks_3 ratfink with 0.5 thanks per post
    4. looks_4 Koepisch with 0.5 thanks per post
    1. trending_up 12,573 views
    2. thumb_up 9 thanks given
    3. group 4 followers
    1. forum 24 posts
    2. attach_file 1 attachments




 
Search this Thread
  #21 (permalink)
 
Tasker_182's Avatar
 Tasker_182 
Cedar Rapids, iowa
Legendary Market Wizard
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Ninjatrader - Continuum
Posts: 716 since Aug 2009
Thanks Given: 476
Thanks Received: 1,405


cory View Post
use FirstTickOfBar so you don't have to set CalcOnbarclose=true.

I understand that but my point is that your example code had CalculateOnBarClose = true, in the initialize section. Seems like a conflict.


Be yourself; everyone else is already taken. Oscar Wilde
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The May 31 Binary: 60% Trump Declares Iran Ops Over, Onl …
Prediction Markets & Event Contracts
Zytrade: Devin Brady, CEO - Ask Me Anything (AMA)
Brokers
BofA Projects $1.1 Trillion in Sports Event Contracts -- …
Prediction Markets & Event Contracts
CME Lists U.S. Election Event Contracts as 2028 Democrat …
Prediction Markets & Event Contracts
May 26 Deadline Dies at 7.5% as US Strikes Iran During C …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
5 thanks
  #22 (permalink)
 
cory's Avatar
 cory 
virginia
the coin hunter
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,093


Tasker_182 View Post
I understand that but my point is that your example code had CalculateOnBarClose = true, in the initialize section. Seems like a conflict.

the best practice is having CalculateOnBarClose = true first, see how long it takes before turn it off.


Reply With Quote
  #23 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,550 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,430



Tasker_182 View Post
I understand that but my point is that your example code had CalculateOnBarClose = true, in the initialize section. Seems like a conflict.

No conflict, when Ninja says 'of no value' they just mean if CalculateOnBarClose is true then it is redundant. As a general performance tip, simple conditional tests are ultra fast operations, to be used in advance of anything else.


Travel Well
Visit my NexusFi Trade Journal Reply With Quote
  #24 (permalink)
 
Adamus's Avatar
 Adamus 
London, UK
 
Experience: Beginner
Platform: NinjaTrader, home-grown Java
Broker: IB/IQFeed
Trading: EUR/USD
Posts: 1,064 since Dec 2010
Thanks Given: 471
Thanks Received: 789


Koepisch View Post
Nice coding so far. You can test that you don't call the Get.. functions every time. If you call it 2 times for 2 consecutive IDXs then you can interpolate the other values.

Awesome tip! Unless I screwed up somewhere with the timings I recorded, my inner loop dropped from average 75 microsecs to 15 microsecs.


You can discover what your enemy fears most by observing the means he uses to frighten you.
Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #25 (permalink)
 
Zondor's Avatar
 Zondor 
Portland Oregon, United States
 
Experience: Beginner
Platform: Ninjatrader®
Broker: CQG, Kinetick
Trading: Gameplay Klownbine® Trading of Globex
Posts: 1,333 since Jul 2009
Thanks Given: 1,246
Thanks Received: 2,734

If running on COBC false you can reduce the number of executions of OnBarUpdate by at least 70% by rejecting those price ticks that have the same price as the preceding tick and are not FirstTickOfBar.

if close[0]=previous close and NOT FirstTickOfBar return....


"If we don't loosen up some money, this sucker is going down." -GW Bush, 2008
“Lack of proof that something is true does not prove that it is not true - when you want to believe.” -Humpty Dumpty, 2014
“The greatest shortcoming of the human race is our inability to understand the exponential function.”
Prof. Albert Bartlett
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on December 9, 2013


© 2026 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 - Downloads - Top
no new posts