• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NinjaTrader Add indicator from indicator - another approach?

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

    NinjaTrader Add indicator from indicator - another approach?

    I was trying to find a solution for the mentioned problem, and I think I was near - in strategies, I've created a sample strategy:

    Code:
    namespace NinjaTrader.Strategy
    {
    	public class SBExample  : StrategyBase{
    		NinjaTrader.Indicator.IndicatorBase indi_ ;
    		private int panelN;
    
    		public void Add_(NinjaTrader.Indicator.IndicatorBase indi__ , int panel_ ){ 
    			indi_ = indi__;
    			panelN= panel_;
    		} 
    		protected override void Initialize()
                    {
                        Add(indi_);
    		    indi_.Panel = panelN;
                    }
    	}
    }

    the I create a simple indicator:

    Code:
    namespace NinjaTrader.Indicator
    {
        [Description("Enter the description of your new custom indicator here")]
        public class sample : Indicator
        {
            protected override void Initialize()
            {
    			NinjaTrader.Strategy.SBExample  sb= new NinjaTrader.Strategy.SBExample();
    			sb.Add_(EMA(20), 1); 
    			sb.SetUp();
            }
            protected override void OnBarUpdate() {  }
        }
    }

    When I add "sample indicator" on chart, it compiles well, but on chart, the "EMA" indicator is not being shown. I think I am near to achieve goal? what you think?
    Last edited by TazoTodua; 03-12-2018, 12:04 PM.

    #2
    Hello TazoTodua,

    Thanks for your inquiry.

    A hosting indicator will need to add its own Plots so the data can be viewed as a plot in the price panel or the indicator panel.

    I've attached a sample indicator demonstrating.

    I will also link to our example demonstrating how a strategy can manipulate an indicator for Strategy based plots in NT7.

    Plotting from a NinjaScript Strategy - https://ninjatrader.com/support/foru...ead.php?t=6651

    Please let me know if we can be of additional help.
    Attached Files
    JimNinjaTrader Customer Service

    Comment


      #3
      Jim, thanks but you didnt quite catch what I wanted to achieve. The way you said, I know already. Instead, I was trying to avoid to again code plots. Because, let's say I am adding indicaot, which have different kind of plots, arrows and etc and etc... So, I wanted to use `Add()` exactly like it is done from `Strategy` (which you linked), why that cant be achieved from Indicators too? I think my code was somehow near to achieve the same.

      Comment


        #4
        Hello TazoTodua,

        Thanks for your additional question.

        To answer your question simply, Add() for adding an indicator is available through strategies, but is not available through indicators.

        In NT7, all we have available to display plots is the hosting indicator that contains the plots that we can write to. We cannot call Add() to add an indicator to an indicator, since this is only available for Strategies.

        Since we cannot use Add() to add an indicator within an indicator, any drawing objects will have to be implemented into the hosting indicator.

        Please let me know if you have any additional questions.
        JimNinjaTrader Customer Service

        Comment


          #5
          1) Jim, you are right what you say, but my main interest lies in, why INDICATORS cant do that? is there anything problem with code? i.e. is that functionality private to strategies, or why can the code I've given, cant be modified as it could achieve the goal?

          What programmatic problem is the barrier?

          thanks!

          2) btw, it's good if even for nt8 you would create feature request that Indicators could do that.

          Comment


            #6
            Hello TazoTodua,

            The Add() functionality is different between indicators and strategies. The functionality to add an indicator with Add() is simply unavailable in indicators when it is in strategies.

            NinjaTrader 8 uses "AddChartIndicator()" and the functionality is the same for being able to add an indicator to an indicator with this method vs. using this method to add the indicator to a chart. (We can use this method in strategies but not within indicators.) We do have a feature request tracking interest in this enhancement, and I will gladly submit a vote on your behalf.

            The ticket Id is SFT-2366.

            Please keep in mind, feature requests are fulfilled based on the development team's priorities and we cannot offer an ETA or promise of fulfillment. Upon implementation, the ticket ID's can be seen in the Release Notes page of the help guide.

            Release Notes: https://ninjatrader.com/support/help...ease_notes.htm

            If you have any additional questions, please let me know.
            JimNinjaTrader Customer Service

            Comment


              #7
              Originally posted by TazoTodua View Post
              1) Jim, you are right what you say, but my main interest lies in, why INDICATORS cant do that? is there anything problem with code? i.e. is that functionality private to strategies, or why can the code I've given, cant be modified as it could achieve the goal?

              What programmatic problem is the barrier?

              thanks!

              2) btw, it's good if even for nt8 you would create feature request that Indicators could do that.
              The programming problem is that the Add() method is not implemented, and so not available for use with Indicators.

              Of course, you can always write your own method to implement such functionality, but you would probably have to know internal details that are unavailable from NT, as it is a closed source tree.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by pstrusi, Today, 03:11 PM
              0 responses
              12 views
              0 likes
              Last Post pstrusi
              by pstrusi
               
              Started by godric, Today, 01:29 PM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Jim  
              Started by blar58, Today, 02:06 PM
              1 response
              10 views
              0 likes
              Last Post NinjaTrader_JoshG  
              Started by woodyfox, Yesterday, 08:06 AM
              3 responses
              16 views
              0 likes
              Last Post NinjaTrader_PatrickH  
              Started by julifro, Today, 11:58 AM
              1 response
              5 views
              0 likes
              Last Post NinjaTrader_PaulH  
              Working...
              X