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 cmoran13, 04-16-2026, 01:02 PM
        0 responses
        43 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        25 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        162 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        98 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        157 views
        2 likes
        Last Post CaptainJack  
        Working...
        X