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

Add cached indicator

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

    Add cached indicator

    hi,

    I have a strategy that uses an indicator. Say the user adds that same indicator on the same chart. Can I get NT to use that instance of the indicator in my strategy when I call add or when I make a reference to the indicator properties?

    From the 30,000 ft view I had of the code, it looks like there is a cache?

    Onn

    #2
    Hello onnb1,

    Thanks for your note.

    Separate instances of NinjaScripts are not able to communicate with each other.

    Each separate instance of a script will have its own location in memory, and will make its calculations separately.


    I will forward this to our development department as a feature request. I will update you with a tracking ID for this feature request when it is available.

    Please do not hesitate to contact us for any other NinjaTrader inquiries you may have.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi onnb1,

      I got an update from our development department. They let me know that NinjaTrader does do optimization under the hood.

      As long as the indicator added uses the exact same parameters on the same instrument with the same input series and that indicator is called from the same host, the second indicator added will be a cached instance.


      Please let me know if this does not resolve your inquiry.
      Last edited by NinjaTrader_Jim; 12-23-2020, 03:23 PM.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Please see this thread and pdf.






        Originally posted by onnb1 View Post
        hi,

        I have a strategy that uses an indicator. Say the user adds that same indicator on the same chart. Can I get NT to use that instance of the indicator in my strategy when I call add or when I make a reference to the indicator properties?

        From the 30,000 ft view I had of the code, it looks like there is a cache?

        Onn

        Comment


          #5
          Hi sledge,

          Thank you for bringing my attention to this pdf that explains a work around for calling indicators more efficiently.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            kudos on the follow up! I'll look to see if I am indeed receiving the same indicator when one is already
            on the chart. From a brief look it doesn't look like it is.

            I do the following:
            1. I add indicator X and let it run for a few bars
            2. I add and enable the strategy which adds indicator X in the initialize method which causes it to be displayed on the screen

            I'll take a look at it - perhaps it is the parameters that are not the same so the cache is not returning the same instance.

            (the strategy version I see plotted is missing historical data. the context of this is that indicator X implements OnMarketData and plot information based on that. So I was expecting that if an indicator has been on the chart, the strategy version of the indicator would pick up all market data previous to enabling the strategy - if this does not make sense, no worries.)

            Onn

            Comment


              #7
              Originally posted by NinjaTrader_ChelseaB View Post
              Hi sledge,

              Thank you for bringing my attention to this pdf that explains a work around for calling indicators more efficiently.
              I second that. Nice article and saving a reference to the indicator like that is an excellent best practice I will be quick to adopt.

              Onn

              Comment


                #8
                Originally posted by onnb1 View Post
                I second that. Nice article and saving a reference to the indicator like that is an excellent best practice I will be quick to adopt.

                Onn
                I'm not feeling out of cycles yet, so I haven't tried any of it.

                I only was researching something else the other night and had come upon this and made the match.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by josh18955, 03-25-2023, 11:16 AM
                6 responses
                436 views
                0 likes
                Last Post Delerium  
                Started by FAQtrader, Today, 03:35 PM
                0 responses
                5 views
                0 likes
                Last Post FAQtrader  
                Started by rocketman7, Today, 09:41 AM
                5 responses
                18 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by frslvr, 04-11-2024, 07:26 AM
                9 responses
                127 views
                1 like
                Last Post caryc123  
                Started by selu72, Today, 02:01 PM
                1 response
                14 views
                0 likes
                Last Post NinjaTrader_Zachary  
                Working...
                X