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

Access data from within my c# code of another indicator

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

    Access data from within my c# code of another indicator

    Hallo, assume you have a chart with an vwap and an sma on it, added via the usual way.
    Now I want to program my own indicator in c# and have access to the values of vwap and sma for each bar within my oncalculate() method.
    How can I access these values of other indicators, viusiosble on the chart, but not initiated in my own code ?

    #2
    Originally posted by TraderChris123 View Post
    Hallo, assume you have a chart with an vwap and an sma on it, added via the usual way.
    Now I want to program my own indicator in c# and have access to the values of vwap and sma for each bar within my oncalculate() method.
    How can I access these values of other indicators, viusiosble on the chart, but not initiated in my own code ?
    Not initiated in your own code?
    Do you know what you're asking?

    You mean you want to search through the current indicators
    on the chart, identify the vwap and sma, and use the ones
    you find on the chart?

    You sure you want to do that?
    Seems like a big pain to do it that way.

    I think you should 'initiate' the indicators you want directly
    inside your own code -- this is the normal way to do it.

    Comment


      #3
      "You mean you want to search through the current indicators
      on the chart, identify the vwap and sma, and use the ones
      you find on the chart?"

      Yes, that was the plan.

      Comment


        #4
        Originally posted by TraderChris123 View Post
        How can I access these values of other indicators, viusiosble on the chart, but not initiated in my own code ?
        Take a look at this.

        Comment


          #5
          Originally posted by bltdavid View Post

          Take a look at this.
          Thank you.
          The disadvantage of initiating the indicator in my code is, from my point of view, that i have to either configure them hard coded or have to present all setting possibilities to the user from within my code. The other way around I could use the settings that already exists and I would only have to access the values of the indicators.

          Comment


            #6
            Maybe so, but your development path seemed
            kinda odd to me.

            I mean, vwap and sma are not very intensive
            when it comes to user parameters.

            And what if the vwap and sma are not on the chart?

            You're making a lot of extra work for yourself (and
            the user) to avoid some relatively trivial things.

            Are you going to require the user to add the VWAP
            and SMA to the chart before adding your indicator?
            That's extra work for the user.

            What about if they have 2 or more SMAs on the
            chart, how will you know which one to use?

            Your current approach will lead to madness.

            Just my 2˘.

            :-)

            Comment


              #7
              Originally posted by bltdavid View Post
              Maybe so, but your development path seemed
              kinda odd to me.

              I mean, vwap and sma are not very intensive
              when it comes to user parameters.

              And what if the vwap and sma are not on the chart?

              You're making a lot of extra work for yourself (and
              the user) to avoid some relatively trivial things.

              Are you going to require the user to add the VWAP
              and SMA to the chart before adding your indicator?
              That's extra work for the user.

              What about if they have 2 or more SMAs on the
              chart, how will you know which one to use?

              Your current approach will lead to madness.

              Just my 2˘.

              :-)
              Thx for yout hint, maby you are right and saved me from lots of trouble ;-)

              Comment


                #8
                Hello, thanks for writing in. The only supported way for indicators to read other indicators is through "hosting" the indicator i.e. initializing an indicator object from within the host indicator. For an example of this, see the "SampleMACrossover" strategy.

                Chris L.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by geddyisodin, 04-25-2024, 05:20 AM
                8 responses
                61 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by jxs_xrj, 01-12-2020, 09:49 AM
                4 responses
                3,288 views
                1 like
                Last Post jgualdronc  
                Started by Option Whisperer, Today, 09:55 AM
                0 responses
                5 views
                0 likes
                Last Post Option Whisperer  
                Started by halgo_boulder, 04-20-2024, 08:44 AM
                2 responses
                22 views
                0 likes
                Last Post halgo_boulder  
                Started by mishhh, 05-25-2010, 08:54 AM
                19 responses
                6,189 views
                0 likes
                Last Post rene69851  
                Working...
                X