Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

indicator of a multiintrument

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

    indicator of a multiintrument

    I am trying to set up a strategy in which one of the checks is to see if the price is greater than to lower Bollinger Band. However when i call on the Bollinger (or just SMA) it is giving me crazy results as it uses the input of all instruments. Can you please advise?
    thx!

    #2
    *this Bollinger check is being done inside another indicator

    Comment


      #3
      Hello nightriderx,

      You can see a sample multi instrument implementation through Tools > Edit NinjaScript > Strategy.

      If you can share the code snippet you're working with, we can take a look and offer input.
      Ryan M.NinjaTrader Customer Service

      Comment


        #4
        ok so for example to get the closing price of the first instrument i would have:

        Closes[0][0]

        ...of the second instrument...

        Closes[1][0]

        How can I see if Closes[1][0] is > than the Lower Bollinger Band of instrument [1]

        Comment


          #5
          You can use BarsArray [ ] in the Bollinger expression.

          if (Closes[1][0] > Bollinger(BarsArray[1], 13, 3).Lower[0])
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            tried it but am now getting:

            Error on calling 'OnBarUpdate' method for indicator '_' on bar 1: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

            using:
            Print ("wma 50-10: "+ WMA(BarsArray[0],50)[10]);

            I know in a strategy I have to increase the look back period, how do I fix this in an indicator, which as I understood should start plotting/returning data once enough bars are gathered?

            thx!

            Comment


              #7
              You need to follow principles here:
              Make sure you have enough bars in the data series you are accessing

              You may need a check similar to

              if (CurrentBar < 10) return;

              If you need this check for another series, it's with CurrentBars [ ] and then an index value indicating the series.
              Ryan M.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              647 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              368 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              108 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              571 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              573 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X