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

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 PhillT, 04-19-2024, 02:16 PM
              4 responses
              31 views
              0 likes
              Last Post PhillT
              by PhillT
               
              Started by ageeholdings, 05-01-2024, 05:22 AM
              5 responses
              36 views
              0 likes
              Last Post ageeholdings  
              Started by reynoldsn, Today, 02:34 PM
              0 responses
              10 views
              0 likes
              Last Post reynoldsn  
              Started by nightstalker, Today, 02:05 PM
              0 responses
              17 views
              0 likes
              Last Post nightstalker  
              Started by llanqui, Yesterday, 09:59 AM
              8 responses
              30 views
              0 likes
              Last Post llanqui
              by llanqui
               
              Working...
              X