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 Taddypole, 04-26-2024, 02:47 PM
        2 responses
        12 views
        0 likes
        Last Post Taddypole  
        Started by futtrader, 04-21-2024, 01:50 AM
        6 responses
        58 views
        0 likes
        Last Post futtrader  
        Started by sgordet, Today, 11:48 AM
        0 responses
        4 views
        0 likes
        Last Post sgordet
        by sgordet
         
        Started by Trader146, Today, 11:41 AM
        0 responses
        5 views
        0 likes
        Last Post Trader146  
        Started by jpapa, 04-23-2024, 07:22 AM
        2 responses
        22 views
        0 likes
        Last Post rene69851  
        Working...
        X