Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing values from another indicator.

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

    Accessing values from another indicator.

    Hello NT Support (or anyone else please).

    I have an indicator, in this case named KayButtons. I have "private IntSeries buttonCode;" in variables, have "buttonCode = new IntSeries(this);" in protected override void Initialize(), and in protected override void OnBarUpdate(), have "buttonCode.Set(1) or buttonCode.Set(2) or buttonCode.Set(3), depending on certain conditions. I also have the code below in properties:
    [Browsable(false)]
    [XmlIgnore()]
    public IntSeries ButtonCode
    {
    get { return buttonCode; }
    }



    By the way, I am still a novice in NTScripts / C#. I just make do by nicking and amending snippets of codes here and there. What I wanted to do was access the value of buttonCode.Set from another of my indicators, in this case named KayStopLines3. So in KayStopLines3, I have the following code in protected override void OnStartUp(), if (KayButtons.ButtonCode == 1)

    Unfortunately, I get the following error when I try to compile it:
    'NinjaTrader.Indicator.Indicator.KayButtons()' is a 'method' which is not valid in this given context

    Could I please request your assistance in resolving this error please?

    Many thanks
    Dan


    #2
    Originally posted by rabcnesbit View Post
    Hello NT Support (or anyone else please).

    I have an indicator, in this case named KayButtons. I have "private IntSeries buttonCode;" in variables, have "buttonCode = new IntSeries(this);" in protected override void Initialize(), and in protected override void OnBarUpdate(), have "buttonCode.Set(1) or buttonCode.Set(2) or buttonCode.Set(3), depending on certain conditions. I also have the code below in properties:
    [Browsable(false)]
    [XmlIgnore()]
    public IntSeries ButtonCode
    {
    get { return buttonCode; }
    }


    By the way, I am still a novice in NTScripts / C#. I just make do by nicking and amending snippets of codes here and there. What I wanted to do was access the value of buttonCode.Set from another of my indicators, in this case named KayStopLines3. So in KayStopLines3, I have the following code in protected override void OnStartUp(), if (KayButtons.ButtonCode[0] == 1)

    Unfortunately, I get the following error when I try to compile it:
    'NinjaTrader.Indicator.Indicator.KayButtons()' is a 'method' which is not valid in this given context

    Could I please request your assistance in resolving this error please?

    Many thanks
    Dan
    ButtonCode is an IntSeries, so should be properly referenced with an index (CurrentValue == index zero). Correction is in the code.

    Comment


      #3
      Originally posted by koganam View Post
      ButtonCode is an IntSeries, so should be properly referenced with an index (CurrentValue == index zero). Correction is in the code.
      Hello koganam,

      Thanks for your reply. I tried your suggestion above - if (KayButtons.ButtonCode[0] == 1), but I still get the same error message when I tried to compile it.

      Thanks
      Dan

      Comment


        #4
        Originally posted by rabcnesbit View Post
        Hello koganam,

        Thanks for your reply. I tried your suggestion above - if (KayButtons.ButtonCode[0] == 1), but I still get the same error message when I tried to compile it.

        Thanks
        Dan
        My mistake. You have to reference the indicator with its calling parameters.

        if (KayButtons(string[] Parameters).ButtonCode[0] == 1)

        i.e, the calling convention is always

        Class(parameter list).TypeOfSeries[int index]
        Last edited by koganam; 04-01-2012, 04:31 PM.

        Comment


          #5
          Originally posted by koganam View Post
          My mistake. You have to reference the indicator with its calling parameters.

          if (KayButtons(string[] Parameters).ButtonCode[0] == 1)

          i.e, the calling convention is always

          Class(parameter list).TypeOfSeries[int index]
          Thanks koganmam.

          What will be the calling parameters, i.e. what should I put inside (string[] Parameters) ?

          Thanks
          Dan

          Comment


            #6
            Originally posted by rabcnesbit View Post
            Thanks koganmam.

            What will be the calling parameters, i.e. what should I put inside (string[] Parameters) ?

            Thanks
            Dan
            The calling parameters are the inputs that you have specified in the public properties for the indicator, when you coded the indicator. (i.e., any property that has a setter). Intellisense should be able to help you, if you cannot determine the correct order.

            Comment


              #7
              Originally posted by koganam View Post
              The calling parameters are the inputs that you have specified in the public properties for the indicator, when you coded the indicator. (i.e., any property that has a setter). Intellisense should be able to help you, if you cannot determine the correct order.
              Many thanks.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              587 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              341 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              103 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              555 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              552 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X