• 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

Drawing Labels in Y Scale

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

    Drawing Labels in Y Scale

    I am doing some custom rendering and I need labels in the Y scale at certain values. Things I have tried:

    1. Draw my own labels in OnRender: This works but labels appear to go under the Y scale. I think they are just off the chart canvas
    2. Add a Plot and set the value but change the line color to transparent: Hides the line just fine but also hides the label

    Is there any known approach to putting labels in the Y scale? Custom Rendering or otherwise?

    #2
    Hello swcooke,

    There are no supported methods for rendering in the price margin on a chart.

    A plot can be added to an indicator, and on each new bar of the indicator the BarBrush can be set to transparent. The plot label would still be colored in this approach.
    https://ninjatrader.com/support/help...s/barbrush.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I am still not understanding. Is there a more specific example you could give? Here is what I tried in an effort to show the label of Plot1 without the line:

      Code:
              protected override void OnStateChange()
              {
                  if (State == State.SetDefaults)
                  {
                      Description                                    = @"Enter the description for your new custom Indicator here.";
                      Name                                        = "CandleTest";
                      Calculate                                    = Calculate.OnPriceChange;
                      IsOverlay                                    = false;
                      DisplayInDataBox                            = true;
                      DrawOnPricePanel                            = true;
                      DrawHorizontalGridLines                        = true;
                      DrawVerticalGridLines                        = true;
                      PaintPriceMarkers                            = true;
                      ScaleJustification                            = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                      IsSuspendedWhileInactive                    = true;
                      DrawLabel     = true;
                      AddPlot(new Stroke(Brushes.Black), PlotStyle.Line, "Plot1");
                  }
                  else if (State == State.Configure)
                  {
                  }
              }
      
              protected override void OnBarUpdate()
              {
                  if(DrawLabel){
                      Plot1[0] = Close[0];
                      Plots[0].Brush = Brushes.Transparent;
                  }
      
              }

      Comment


        #4
        Hello swcooke,

        I am suggesting you set the BarBrush for each bar not the plot brush.

        Below is a link to the help guide which includes an example.
        https://ninjatrader.com/support/help...s/barbrush.htm

        Code:
        protected override void OnBarUpdate()
        {
        Value[0] = Close[0];
        BarBrush = Brushes.Transparent;
        }
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          My request is for a way to draw a label in a pane that I am custom rendering in. Not in the main pane. I have added the plot because it gets me the label. However, I don't want to see the line the plot draws. I just want to see the label. Setting BarBrush = Brushes.Transparent just changes the color of the brush used in the main pane. It seems to have no effect on my Plot.

          Comment


            #6
            Hello swcooke,

            You have previously mentioned:

            " I need labels in the Y scale at certain values"

            When you mention the Y scale are you talking about the price margin to the right of the chart?

            Also, you are correct, it would not be the BarBrush... it would be the PlotBrushes. That was my mistake. Sorry about the confusion on that.

            https://ninjatrader.com/support/help...lotbrushes.htm

            PlotBrushes[0][0] = Brushes.Transparent;
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              PlotBrushes[0][0] = Brushes.Transparent; makes the label transparent as well. I am trying to keep the label. When I mention the Y scale, I am referring to the right scale of my indicator pane.

              Comment


                #8
                Hello swcooke,

                I overlooked that the last bar cannot be set. This means at least one bars plot value would need to be visible on the chart.

                So if (CurrentBar > 0) PlotBrushes[0][1] = Brushes.Transparent; would likely be as close as this could get.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Chelsea,

                  There has to be a better way to get a simple price marker in the scale. Can you share this post with the team and see if there are any better ideas for getting this done?

                  Comment


                    #10
                    Hello swcooke,

                    One suggestion that came from the team is to prevent all rendering from the indicator completely.

                    https://ninjatrader.com/support/foru...207#post786207
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Why do I feel like we are going round and round here? That example does nothing more than what my original example does. Which is further highlight the fact that this is not possible. And the post you referenced is from 2012 and is littered with upvotes for a way to do this. Has the development team rejected this idea or is it still in the works since 2012? What am I missing here? How can I view the development teams response to why this was not implemented?

                      Comment


                        #12
                        Hello swcooke,

                        It is not possible to show a plot marker without a plot using any supported methods. The post linked shows a feature request ID where this is being taken in consideration and shows a workaround of preventing the plot from being rendered but still showing the plot marker in the price margin.

                        It is up to the NinjaTrader Development to decide if or when any request will be implemented.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Your work around to prevent the plot from being rendered while still showing the label, does not work. Feel free to test for yourself and if you are able to get it working, send me the exported indicator so I can import a working version?

                          Comment


                            #14
                            Hello swcooke,

                            Attached is a screenshot of how the example script linked in post #10 looks on my end without any modifications to the code.

                            May I have a screenshot of how this looks on your end (on a chart with no other indicators applied)?

                            If you are experiencing different behavior, please send an email to platformsupport [at] ninjatrader [dot] com so that I may test the example script on your end. In the email please included a link to this forum thread.
                            Attached Files
                            Last edited by NinjaTrader_ChelseaB; 05-23-2019, 11:41 AM.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              I just want to see the label. Setting BarBrush = Brushes.Transparent just changes the color of the brush used in the main pane.
                              Nox Vidmate VLC
                              Last edited by bandass; 05-27-2019, 02:50 PM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by priceisking, Today, 12:51 PM
                              1 response
                              11 views
                              0 likes
                              Last Post NinjaTrader_PaulH  
                              Started by chartish, Today, 10:33 AM
                              3 responses
                              18 views
                              0 likes
                              Last Post chartish  
                              Started by casabella, Today, 11:51 AM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_PaulH  
                              Started by Johnny, Today, 11:42 AM
                              1 response
                              13 views
                              0 likes
                              Last Post NinjaTrader_Jermaine  
                              Started by habibalex, Today, 09:03 AM
                              2 responses
                              14 views
                              0 likes
                              Last Post sledge
                              by sledge
                               
                              Working...
                              X