Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reduce CPU load for CalculateOnBarClose = false

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Reduce CPU load for CalculateOnBarClose = false

    Hi,

    I'm trying to reduce the CPU load of an indicator, that does run with
    CalculateOnBarClose = false
    I'm only doing calculations with the last price, no volume or tick count...

    Would this be possible with a variable, that stores the last price and checks for a change and if there is no change in price returns?

    How would this look like?

    Thanks

    Thomas

    #2
    Hello td_910,
    Yes, it is possible to do so with a price based indicator and you will witness substantial performance enhancement.

    A sample code will be like:

    in Variable:
    Code:
    double lastClose = 0;
    in OnBarUpdate
    Code:
    if (!FirstTickOfBar && Close[0] == lastClose) return;
    
    lastClose = Close[0];
    //rest of the code.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Many thanks Joydeep.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      574 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      332 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      553 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X