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

Strategy Host of a Multi-series Indicator, getting differing data

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

    Strategy Host of a Multi-series Indicator, getting differing data

    The attached demo strategy hosts a demo indicator. The indicator adds a 1 tick data series on the same base chart series.
    The resulting values of the strategy plot differ slightly from the same indicator plot, on the same chart when applied individually?
    Moreover, when I use a Print statement referencing the strategy plot series, the value printed is equal to the passed in Period value used to call the indicator, not the value shown in the plot series on the chart?

    There is something I clearly don't understand related multi series indicator plotting that I need some help with!

    First, is this even supported?
    Attached Files

    #2
    Inside your strategy's OnBarUpdate, you have this code,

    Code:
                if (BarsInProgress == 1)
                {
                    _tickCounter = TickCounterMJ(Period);
                }
    What is the purpose of this code?

    Comment


      #3

      https://ninjatrader.com/support/helpGuides/nt8/

      ​​​​​​
      Tip: If you are adding an indicator which is dependent on the correct State of the indicator, you will need to ensure that you are also calling the indicator from the strategy in OnBarUpdate(), otherwise your indicator will only process in State.RealTime for performance optimizations.

      Comment


        #4
        Thanks!

        Is that a documented tip?

        I looked in the provided links but could not find a tip with that wording.

        Did I miss something?

        Btw, when I read that tip, the word indicator is used four times,

        "Tip: If you are adding an indicator which is dependent on the correct State of the indicator,
        you will need to ensure that you are also calling the indicator from the strategy in OnBarUpdate(),
        otherwise your indicator will only process in State.RealTime for performance optimizations."

        I presume the last 3 uses of "indicator" really mean the added indicator, right?

        And, what exactly does 'calling the indicator' mean?

        I've always used Update() to achieve that -- is this no longer enough?

        Comment


          #5
          Hmm ..

          In the tip you cited,
          should the 2nd use of the word "indicator" actually be the word "strategy" instead?

          The initial wording in the tip confuses me.

          [Sorry to hijack your thread ... but thanks for helping me understand.]
          Last edited by bltdavid; 08-11-2020, 10:32 AM.

          Comment


            #6
            Hello lavalampmj,

            Thank you for your reply,

            Since you're only updating the indicator once per bar, on the first tick of the primary series' bar, all of the logic to assign that to the plot should go within your BarsInProgress == 0 check. Plots should really only be updated during BIP == 0. I've attached a revised version of the indicator that gives the same result whether called from the Strategy or just given by the indicator itself.

            Please let us know if we may be of further assistance to you.





            Attached Files
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              Thank you bltdavid and Kate. :-)

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by CortexZenUSA, Today, 12:53 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by CortexZenUSA, Today, 12:46 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by usazencortex, Today, 12:43 AM
              0 responses
              5 views
              0 likes
              Last Post usazencortex  
              Started by sidlercom80, 10-28-2023, 08:49 AM
              168 responses
              2,266 views
              0 likes
              Last Post sidlercom80  
              Started by Barry Milan, Yesterday, 10:35 PM
              3 responses
              13 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X