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 XXtrader, Yesterday, 11:30 PM
        2 responses
        11 views
        0 likes
        Last Post XXtrader  
        Started by Waxavi, Today, 02:10 AM
        0 responses
        6 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by TradeForge, Today, 02:09 AM
        0 responses
        11 views
        0 likes
        Last Post TradeForge  
        Started by Waxavi, Today, 02:00 AM
        0 responses
        2 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by elirion, Today, 01:36 AM
        0 responses
        7 views
        0 likes
        Last Post elirion
        by elirion
         
        Working...
        X