Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Retrieving the symbol name within the script

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

    Retrieving the symbol name within the script

    Hi,

    I'm trying to write a script where I need to add a secondary chart within the script with the same symbol as the primary chart that I'm adding the custom script on.

    I'm currently calling the symbol name using Instrument.Fullname but when i change the symbol on the chart from the drop down menu the indicator doesnt work.

    I'd really appreciate any help with this.

    #2
    Hello buylosellhi,

    I'm trying to write a script where I need to add a secondary chart within the script with the same symbol as the primary chart that I'm adding the custom script on.
    For this you can use the Add() overload that doesn't require an instrument specified. The secondary series is then always the same instrument as the primary.

    Add(PeriodType.Minute, 15);

    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi Ryan,

      I'm using the AddRenko() function. Does that work without the instrument name as well ?

      thanks again

      Comment


        #4
        Unfortunately an instrument has to be specified for the AddRenko() method - are you getting any errors when the script is not working anymore for you? Does it depend on how you change the primary input series or is change here generally throwing it off?

        Thanks,

        Comment


          #5
          now the indicator just stopped working. i tried creating a new one from scratch and there is no output

          Comment


            #6
            Can you share the indicator you attempted running so we can look into it? If you check the Control Center's log tab - any errors listed there?

            Comment


              #7
              Bertrand, thanks for your msg.
              i sent the indicator to ninja support group email.

              Comment


                #8
                here is the error I'm getting in the log. this indicator was working fine yesterday
                "Error on calling 'OnBarUpdate' method for indicator 'test' on bar 0: 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."

                Comment


                  #9
                  Thanks - this normally means you're not having a proper CurrentBars check for all series defined, such as

                  if (CurrentBars[0] < 0 || CurrentBars[1] < 0 ....) return;

                  This would be put at your OnBarUpdate() start to ensure only valid bars are accessed.

                  Comment


                    #10
                    that did it ! thanks much
                    i'm surprised why it was working yesterday and not today...

                    thanks again

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    576 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    334 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    101 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    553 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    551 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X