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

indicators collection

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

    indicators collection

    Is there a way to get a list of all available indicator by programming ?

    It seems there is a IndicatorCollection class , and there is private member of IndicatorCollection in IndicatorBase class .

    ...

    My other question is when is a indicator instantiated (when one of the constructor is called) ? I use the NinjaTrader Chart application , and in that case do all indicators get constructed when a chart runs ?

    #2
    Hi coffeedan,

    The intellisense will offer all the accessible indicators
    More info at - http://www.ninjatrader-support.com/H...l?Intellisense

    You can also reference syntax and most overloads from our help guide
    Example at - http://www.ninjatrader-support.com/H...html?Bollinger

    When you call an indicator, an instance is created. If you use the same parameters for an indicator, this call is cached so only one instance is used.

    If that does not clarify, please explain/clarify further.
    TimNinjaTrader Customer Service

    Comment


      #3
      checking list of indicators at runtime

      I just want to check what indicators are available at runtime. For example, if I run the ninjatrader chart application , a user can choose from a list of indicators. So there must be a way to get a list of indicators at runtime (for example , when a chart is running )

      And most of all, I want to get the list of selected indicators while I am using a chart and running a custom strategy.

      Is there a way inside my strategy class to list the selected indicators ?

      Comment


        #4
        coffeedan,

        Available indicators are any indicators you have installed on your NinjaTrader. They are always available all the time. Not sure what you mean by "at runtime" for this.

        Unfortunately there is no way to access a list of indicators already added onto a chart. If you want to know this I suggest you use a blank chart when you add your strategy and then have the strategy itself add any indicators you want. This way it will only have the indicators your strategy has added and then you will know what is on the chart.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          then how an application such NT Chart can get the list

          How does NT Chart get the list of all Indicators ? Are they all in the same namespaces and are subclass of NinjaTrader.Indicator.Indicator ?

          Comment


            #6
            coffeedan,

            Unfortunately this is outside the scope of what we can support for NinjaScript.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Coffeedan, did you dig anything ? It MUST be a place where NT keeps a data about currently running indicators/strategies.

              Comment


                #8
                Edit: I didn't see the date, sorry. the forum engine showed it to me as similiar thread.


                It is done by the use of reflection. It's quite a good feature of .NET, it is worth the time getting friends with it. If you know how it works, it's not a too complex task to get all indicators.

                Like this:
                PHP Code:
                List<TypedefaultIndis = new List<Type>();

                Assembly assem this.GetType().Assembly;
                defaultIndis.AddRange(from x in assem.GetTypes()
                                         
                where x.IsSubclassOf(typeof(IndicatorBase)) && !x.IsAbstract && x.IsPublic && x.IsVisible
                                         select x
                ); 
                The trick here is the GetTypes() which reads all current types from the given assembly. (which is the assembly where "this" - the indicator itself is sitting)

                Then you can do whatever you want with them:
                PHP Code:
                foreach(Type it in defaultIndis)
                {
                      Print(
                it.ToString());
                 } 
                Note: it works only for default NT indis. For custom dlls, you'll need to find those assemplies first and read their content too.
                Last edited by Zapzap; 11-12-2015, 02:56 PM.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Jonafare, 12-06-2012, 03:48 PM
                5 responses
                3,984 views
                0 likes
                Last Post rene69851  
                Started by Fitspressorest, Today, 01:38 PM
                0 responses
                2 views
                0 likes
                Last Post Fitspressorest  
                Started by Jonker, Today, 01:19 PM
                0 responses
                2 views
                0 likes
                Last Post Jonker
                by Jonker
                 
                Started by futtrader, Today, 01:16 PM
                0 responses
                7 views
                0 likes
                Last Post futtrader  
                Started by Segwin, 05-07-2018, 02:15 PM
                14 responses
                1,791 views
                0 likes
                Last Post aligator  
                Working...
                X