Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator on Indicator performance

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

    Indicator on Indicator performance

    Hi All,
    I have a custom MACD plot that uses the shared MACD routine from Ninja. Part of my code is as follows.

    double val0 = Math.Round(MACD(Fast, Slow, Smooth).Diff[0], 2);
    double val1 = Math.Round(MACD(Fast, Slow, Smooth).Diff[1], 2);
    //do plot val0 vs val1 on screen.

    My question is when OnBarUpdate is called on my custom indicator, does calls tp MACD class cuase it to recalculate on the entire bar series or it calculates only for the current bar (with info for previous bar coming from cache) ?

    Thanks.

    #2
    Hello,

    I think I understand. The values for the indicator are called up via the index. The calculations you have are performed each time there is an OnBarUpdate() event called. This link may help:
    DenNinjaTrader Customer Service

    Comment


      #3
      Hi Ben,
      My question was on each bar update is MACD calculated for all the bars again or just for the latest bar? In other words, does the MACD indicator underlying my custom indicator caches values? Thanks.

      Comment


        #4
        yesbee1 - when you call an indicator, an internal instance of an indicator is created and added to a cache. Futures calls to this method loop through this cache in order to get the correct indicator instance or if one is not found, create a new one.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        585 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        340 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        552 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X