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

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,
        BertrandNinjaTrader Customer Service

        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?
            BertrandNinjaTrader Customer Service

            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.
                  BertrandNinjaTrader Customer Service

                  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 chbruno, Today, 04:10 PM
                    0 responses
                    3 views
                    0 likes
                    Last Post chbruno
                    by chbruno
                     
                    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
                    6 views
                    0 likes
                    Last Post FAQtrader  
                    Started by rocketman7, Today, 09:41 AM
                    5 responses
                    19 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  
                    Working...
                    X