Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Remove Indicator

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

    Remove Indicator

    What would be the equivalent command to remove a previously added indicator from a strategy?

    Thx
    Last edited by P-Sionic; 11-07-2016, 08:20 AM. Reason: Typo

    #2
    Hello,

    Thank you for the question.

    I am not quite sure I understand the question, are you asking how to reverse the Add() syntax to Remove an indicator the strategy added to the chart?

    Can you confirm if you are using Add syntax, if not could you provide a sample of the syntax you are currently using to add the indicator?

    I look forward to being of further assistance.

    Comment


      #3
      Indeed, I add an indicator via e.g. Add(EMA(14)) and want to remove it later depending on some conditions.

      Thanks.

      Comment


        #4
        Hello,

        Thank you for the reply.

        While you cant directly remove the indicator after adding it, you could set its plot to transparent, use the Strategy Plot example or edit the indicator its self.

        One example would be the following or to create a variable of the indicator which can be used in logic:

        Code:
        private SMA mySma;
        protected override void Initialize()
        {
        	mySma = SMA(12);
        	Add(mySma);
        }
        protected override void OnBarUpdate()
        {
        	if(Close[0] > Open[0])
        	{
        		mySma.PlotColors[0][0] = Color.Transparent;
        		//or for the whole plot
        		mySma.Plots[0].Pen = new Pen(Color.Transparent, 0);
        	} else {
        		mySma.PlotColors[0][0] = Color.Red;
        		//or for the whole plot
        		mySma.Plots[0].Pen = new Pen(Color.Red, 1);
        	}
        }
        Another approach is the strategy plot example, in essence the strategy passes a value to a dummy indicator that just plots that value. The strategy can control if the indicator gets a value, the colors of the plots etc.
        When running a strategy on a chart you may find the need to plot values onto a chart. If these values are internal strategy calculations that are difficult to migrate to an indicator, you can use the following technique to achieve a plot. NinjaTrader 8 With NinjaTrader 8 we introduced strategy plots which provide the ability


        Another approach is to make a version of the indicator that includes the logic already to hide its plots when a condition becomes true. Mainly to just make its plots transparent.


        I look forward to being of further assistance.

        Comment


          #5
          Thanks. Thats a viable alternative. In fact I intend showing an Ichimoku indicator each time a respective condition becomes valid for verification and hide it if not. So that solution should work for me.

          Btw. would removing indicators they way I intended previously work in NT8?

          Thanks.

          Comment


            #6
            Hello,

            No this would still be the same type of options for NT8. The script you are applying to the chart tells the platform to then Add the indicator, this all happens when the script is first starting.

            The opposite action or removing actually does happen but only when the script is disabled. I don't believe actually removing the item would be the correct approach, in the case an item needs to be added after that, the script would need reloaded to Add that indicator. Instead the suggested approach would be to add the items you may need and toggle them depending on conditions.

            I look forward to being of further assistance.

            Comment

            Latest Posts

            Collapse

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