Announcement

Collapse
No announcement yet.

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

            Comment


              #7
              Thank you bltdavid and Kate. :-)

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Today, 05:17 AM
              0 responses
              50 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              126 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              69 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              42 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              46 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X