Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add indicator and its plot in custom indicator

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

    Add indicator and its plot in custom indicator

    Hello All,

    Hope you are doing good !!

    What I'm trying to do is to include "Indicator" and "Plot" as part of inputs of my custom NinjaScript program (Strategy or custom Indicator).

    Through these two inputs...
    just like the snapshot...
    I want my program to give me drop-down option for ALL indicators (in "Indicator")...
    and various dataseries of a selected indicator (In "Plot")

    Hope to get better suggestion and advice !!

    Thanks in advance

    Abhishek
    Attached Files

    #2
    Hello engrvivs,

    Thanks for the post.

    The attached file demonstrates various different type converters for the property grid. It has an example of a data series as well. That will help with implementing a list. After you have implemented two drop-down lists, you would need to use the assemblies metadata to get a list of indicators:

    Please note, using reflection is undocumented and not officially supported. Use the code suggested below at your own risk.

    Code:
    Type[] availableIndicatorTypes = NinjaTrader.Core.Globals.AssemblyRegistry.GetDerivedTypes(typeof(IndicatorBase));
    Please let us know if we may be of any further assistance.
    Attached Files

    Comment


      #3
      I appreciate your effort for help.

      I will try your idea and let you know.

      Comment


        #4
        Hello ChrisL,

        From where I can include assemblies metadata to get a list of indicators.
        I think we have use any dlls for this.

        May you help me with this.

        Thanks in advance
        Abhishek
        Last edited by engrvivs; 07-06-2018, 05:29 AM.

        Comment


          #5
          Hello engrvivs,

          Thanks for your patience.

          You do not need to load any dll, the line below will get all indicator names in your installation:

          Code:
          Type[] availableIndicatorTypes = NinjaTrader.Core.Globals.AssemblyRegistry.GetDerivedTypes(typeof(IndicatorBase));
          You might need to use some Reflection techniques to get the plots of the indicators. I was unable to find an example of this property converter. Creating an example would go beyond the scope of support I could provide but a member of the form community might be able to help.

          https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx - MSDN Reflection namespace.

          Comment


            #6
            Okay Chris_L.
            Thanks for the help. I will follow your idea and let you know soon

            Comment


              #7
              Selected Indicator's Plot and Parameter Options

              Hello Chris

              Thanks to your guidance, I was able to display list of all available indicators through a drop-down list in my custom Indicator! Hence, any Indicator can be selected and invoked now. This is displayed in the attached snapshot, "01 Got List of Indicators Names.png".

              I have two corresponding queries.
              1. May you please guide me how I can show other (input) "Parameters", "Plot Options", "Alerts", etc. that correspond to the selected Indicator?
                This is shown in the attached snapshot, "02 Selected Indi - Get Parameters Alerts PlotOptions.png".

              2. Similarly, how can corresponding DataSeries or "Plot" can be fetched and shown as drop-down list for the selected Indicator?
                This is shown in the attached snapshot, "03 Selected Indi - Plots Drop-Down Options.png".


              Both these features are inherent in Market Analyzer's Column, when an Indicator is selected to be displayed.

              Your pointers towards the solution these two points will be very very helpful!

              Thank You!
              Attached Files

              Comment


                #8
                Hello engrvivs,

                Thanks for the reply.

                Some extra digging into the NinjaScript types will need to be done to achieve this. You would need to use the Reflection class to get indicator metadata. The below snippet gets the Avg property of the arbitrarily picked RSI indicator. I will need to leave any additional assistance with this to the community as this is not supported code.

                Code:
                Type[] availableIndicatorTypes = NinjaTrader.Core.Globals.AssemblyRegistry.GetDerivedTypes(typeof(IndicatorBase));
                			System.Reflection.PropertyInfo[] inf;
                			foreach(Type ty in availableIndicatorTypes)
                			{
                				if(ty.Name == "RSI")
                				{
                					inf = ty.GetProperties();
                					foreach(PropertyInfo info in inf)
                					{
                						if(info.Name == "Avg")
                						{
                							Print(info.PropertyType);
                						}
                					}
                				}
                			}
                Please let me know if I may be of any further assistance.

                Comment


                  #9
                  Thanks Chris for your assistance!

                  I will try to re-engineer the desired solution using your code snippet.

                  Still, I look forward to any suggestions from the NT8 developer community in this regard.

                  Kind Regards

                  Comment

                  Latest Posts

                  Collapse

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