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

One Indicator Drive Multiple Panels?

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

    One Indicator Drive Multiple Panels?

    I have several custom indicators that both reference a memory- and CPU-intensive algorithm (which itself is an indicator). Instead of calling this memory-intensive indicator in each of my indicators, I would like to merge my two indicators into a single algorithm so that I only need to call the memory-intensive indicator once instead of twice per cycle. Does this make sense for far?

    The problem is that the plots of my two indicators are very different - they need to be in two different frames.

    My questions are:

    1. Is it possible to make one indicator plot on two different frames?

    2. Is it possible for the same indicator to both plot on the price frame (Overlay = true) and on a different frame (Overlay = false).

    3. If either #1 or #2 is false, do you have suggestions on how to increase the efficiency of my NinjaScripts to elliminate unneccessary referenced to memory intensive code?

    #2
    Hello Serac,

    I understand that you are trying to combine two indicators into a single algorithm.

    1) No, each indicator will be limited to plotting on 1 additional panel. You cannot plot two separate panels from one instances of your indicator.

    2) You would not be able to plot or draw on both the price panel and the indicator panel.

    It would require two indicators to accomplish this. Without knowing more about your indicators, the only advice I can offer you is from our Performance Tips:

    MatthewNinjaTrader Product Management

    Comment


      #3
      Hmmm. That is too bad. Please put that down on the huge list of desired additions to a NT update.

      Here is the deal: The two indicators, say, IndyA and IndyB reference a third indicator that computes the frequency of the input series from a bank of band pass filters. Let's call this third frequency estimating indicator IndyPeriod.

      IndyPeriod is computationally intensive. I have optimized it as much as I can. Both IndyA and IndyB reference IndyPeriod, such as: double period = IndyPeriod(Input)[0]. Then both indicators use the value of period in their calculations. My strategy calls both IndyA and IndyB. I cannot simply call IndyPeriod in my strategy and pass the value to IndyA and IndyB in the strategy because I need current and previous values of IndyA and IndyB in the strategy.

      As I understand, if both IndyA and IndyB call IndyPeriod, all the computations in IndyPeriod will get done twice, and the second time will be redundant to the first.

      Is there any way to define IndyPeriod as some type of global, and simply have IndyA and IndyB reference this global? Does this all make sense?

      Comment


        #4
        Hello Serca,

        As long as you are calling the same indicator with the same exact parameters, the calculation should be internally cached.

        However, there are also ways of passing this data outside of the normal methods. Hopefully the following thread will be of some use:

        MatthewNinjaTrader Product Management

        Comment


          #5
          Matthew,

          Thanks! This is what I needed to know.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by terofs, Yesterday, 04:18 PM
          1 response
          21 views
          0 likes
          Last Post terofs
          by terofs
           
          Started by CommonWhale, Today, 09:55 AM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by Gerik, Today, 09:40 AM
          2 responses
          7 views
          0 likes
          Last Post Gerik
          by Gerik
           
          Started by RookieTrader, Today, 09:37 AM
          2 responses
          12 views
          0 likes
          Last Post RookieTrader  
          Started by alifarahani, Today, 09:40 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X