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

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
    Chris L.NinjaTrader Customer Service

    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.
          Chris L.NinjaTrader Customer Service

          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.
                Chris L.NinjaTrader Customer Service

                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 jaybedreamin, Today, 05:56 PM
                  0 responses
                  2 views
                  0 likes
                  Last Post jaybedreamin  
                  Started by DJ888, 04-16-2024, 06:09 PM
                  6 responses
                  18 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by Jon17, Today, 04:33 PM
                  0 responses
                  1 view
                  0 likes
                  Last Post Jon17
                  by Jon17
                   
                  Started by Javierw.ok, Today, 04:12 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post Javierw.ok  
                  Started by timmbbo, Today, 08:59 AM
                  2 responses
                  10 views
                  0 likes
                  Last Post bltdavid  
                  Working...
                  X