Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is it possible to define an indicator and then setup visuals?

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

    Is it possible to define an indicator and then setup visuals?

    Hi,

    Wanting to know if I can define an indicator for a chart like this:

    AddChartIndicator(KeltnerChannel(OffsetMultiplierI nner, KeltnerPeriod));

    Once that's done, it draws the same blue lines on everything. Is there a way to access the properties so I can define line width, color, etc.?

    Thanks.

    #2
    Hello DogEars,

    Thanks for your post.

    The AddChartIndicator() method is for a Strategy to add an indicator to a chart when the Strategy is applied to the chart. You can change the plot characteristics of the indicator. Please see the link here for examples: https://ninjatrader.com/support/help..._strategie.htm

    If your question is about defining an indicator visuals just to add the indicator to a chart (without strategy use) then yes, you can create indicator "templates" where you predefine all of the characteristics that are available for the indicator. You can create as many different templates as you wish for each indicator. This allows you to apply the indicator in multiple places with different characteristics. Please see: https://ninjatrader.com/support/help...efaultSettings

    Comment


      #3
      Very nice, thanks for the reply.

      Comment


        #4
        I gave this a shot based on that post, and didn't have any success. Tried the .Plots and nothing changed. I then tried this:

        HTML Code:
         KeltnerChannel(OffsetMultiplierInner, KeltnerPeriod).Lines[0].Brush = Brushes.SeaGreen;
        KeltnerChannel(OffsetMultiplierInner, KeltnerPeriod).Lines[0].Width = 2;
        
        KeltnerChannel(OffsetMultiplierMid, KeltnerPeriod).Lines[0].Brush = Brushes.Yellow;
        KeltnerChannel(OffsetMultiplierMid, KeltnerPeriod).Lines[0].Width = 2;
        
        KeltnerChannel(OffsetMultiplierOuter, KeltnerPeriod).Lines[0].Brush = Brushes.Magenta;
        KeltnerChannel(OffsetMultiplierOuter, KeltnerPeriod).Lines[0].Width = 2;
        And it threw an error about "method index was outside the bounds of the array".

        Is what I'm wanting to do possible on the Keltner and Regression channel indicators?

        I might have missed something here, not seeing it.


        Thanks.

        Comment


          #5
          Hello DogEars,

          Thanks for your post.

          Can you clarify where you are trying to do this?

          Some overall context would help.

          Comment


            #6
            Absolutely, sorry for not being more clear. I have a strategy with multiple Keltner Channels and Regression channel as well.

            I would like to be able to change the colors of the lines, and the weighting of those. I can customize the indicators after I load up the strategy, but if I push a new version they go away with every disable/enable action.

            It comes out like this as default when defined:
            Click image for larger version

Name:	2020-12-16_10-46-09.jpg
Views:	261
Size:	323.9 KB
ID:	1132668

            And my goal is to have the defaults look like this:

            Click image for larger version

Name:	2020-12-16_10-46-32.jpg
Views:	222
Size:	246.2 KB
ID:	1132669

            Comment


              #7
              Hello DogEars,

              Thanks for your reply.

              Are you using AddChartIndicator() to add these to the chart?

              If so can you show that code?

              Comment


                #8
                I am, here ya go.

                Code:
                 //add Regression Channel indicator
                AddChartIndicator(RegressionChannel(RegressionPeriod, RegressionWidth));
                
                //add Keltner Channel indicators
                AddChartIndicator(KeltnerChannel(OffsetMultiplierInner, KeltnerPeriod));
                AddChartIndicator(KeltnerChannel(OffsetMultiplierMid, KeltnerPeriod));
                AddChartIndicator(KeltnerChannel(OffsetMultiplierOuter, KeltnerPeriod));

                Comment


                  #9
                  Hello DogEars,

                  Thanks for your reply.

                  The error was created by using .Lines[] as the Keltner Channel does not use lines, it uses Plots.

                  Here is an example I tested without using the variables so you can see what is what:

                  Code:
                   else if (State == State.DataLoaded)
                  {
                  AddChartIndicator(KeltnerChannel(1.5, 10));
                  AddChartIndicator(KeltnerChannel(3, 10));
                  AddChartIndicator(KeltnerChannel(6, 10));
                  
                  KeltnerChannel(1.5, 10).Plots[0].Brush = Brushes.SeaGreen;
                  KeltnerChannel(1.5, 10).Plots[1].Brush = Brushes.SeaGreen;
                  KeltnerChannel(1.5, 10).Plots[2].Brush = Brushes.SeaGreen;
                  KeltnerChannel(1.5, 10).Plots[0].Width = 2;
                  KeltnerChannel(1.5, 10).Plots[1].Width = 2;
                  KeltnerChannel(1.5, 10).Plots[2].Width = 2;
                  
                  KeltnerChannel(3, 10).Plots[0].Brush = Brushes.Yellow;
                  KeltnerChannel(3, 10).Plots[1].Brush = Brushes.Yellow;
                  KeltnerChannel(3, 10).Plots[2].Brush = Brushes.Yellow;
                  KeltnerChannel(3, 10).Plots[0].Width = 2;
                  KeltnerChannel(3, 10).Plots[1].Width = 2;
                  KeltnerChannel(3, 10).Plots[2].Width = 2;
                  
                  KeltnerChannel(6, 10).Plots[0].Brush = Brushes.Magenta;
                  KeltnerChannel(6, 10).Plots[1].Brush = Brushes.Magenta;
                  KeltnerChannel(6, 10).Plots[2].Brush = Brushes.Magenta;
                  KeltnerChannel(6, 10).Plots[0].Width = 2;
                  KeltnerChannel(6, 10).Plots[1].Width = 2;
                  KeltnerChannel(6, 10).Plots[2].Width = 2;
                  }
                  The Keltner channel uses 3 plots and they are counted starting at 0, thus 0, 1 and 2.

                  Here is what that looks like:

                  Click image for larger version

Name:	DogEars-1.PNG
Views:	355
Size:	94.4 KB
ID:	1132691

                  Comment


                    #10
                    Thank you very much for the explanation. I didn't realize there were 3 brushes involved.

                    Much appreciated!

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    579 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    334 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
                    554 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    551 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X