Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by geotrades1, Today, 10:02 AM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by ender_wiggum, Today, 09:50 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by rajendrasubedi2023, Today, 09:50 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by bmartz, Today, 09:30 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by geddyisodin, Today, 05:20 AM
        3 responses
        26 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X