Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator Plot Labels

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

    Indicator Plot Labels

    what's the recommended way to label indicator plots e.g.

    Click image for larger version  Name:	plot.png Views:	0 Size:	11.1 KB ID:	1236793

    #2
    Hello dibDab,

    You are wanting to create something like the Add Plot Names indicator?
    https://ninjatraderecosystem.com/use.../addplotnames/

    You can either custom render text where you would like it in OnRender(), or you can use Draw.Text() which will draw over the bars.




    The <Indicator>.Plots[plot index].Name will have the plot name. The .Plots[plot index].Brush will have the color.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      ok thanks, something to work on.

      so Draw.TextFixed options are BottomLeft, BottomRight, Center, TopLeft & TopRight, presumably overwriting each other if more than 1

      Comment


        #4
        Hello dibDab,

        That is correct, but you can add "\r\n" to a string to add a new line.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          ok thanks again, all useful. but can I use '\r\n' to draw get plot1 & plot2 on different lines in different colors?

          Click image for larger version  Name:	plot.png Views:	0 Size:	11.1 KB ID:	1236914

          Comment


            #6
            Hello dibDab,

            "\r\n" means return and new line.. This is not related to colors.

            Yes, you can supply a brush to a draw method to specify the color.
            Draw.Text(NinjaScriptBase owner, string tag, string text, int barsAgo, double y, Brush textBrush)
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              ok just to clarify, I can use '/r/n' to draw on 2 lines and I can use a brush to define different colours on each line?.

              Comment


                #8
                Hello dibDab,

                Yes, \r\n means new line.

                A brush defines a single color. Each text would have its own brush.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by dibDab View Post
                  ok just to clarify, I can use '/r/n' to draw on 2 lines and I can use a brush to define different colours on each line?.
                  Not quite. One color per draw object. Multiple lines of text in Draw.TextFixed will all be the same color.
                  eDanny
                  NinjaTrader Ecosystem Vendor - Integrity Traders

                  Comment


                    #10
                    ok thanks but to conclude...

                    there is no (easy) way to do the following

                    Click image for larger version

Name:	plot.png
Views:	230
Size:	11.1 KB
ID:	1237536

                    would be useful if multple Draw.TextFixed could be stacked and not simply ovewritten?

                    e.g. Draw.TextFixed(NinjaScriptBase owner, string tag, string text, TextPosition textPosition, int linenumber)

                    Comment


                      #11
                      Hello dibDab,

                      The way to do it would be to use two draw fixed calls for different colors, and on one them add a new line so these are not layered on top of each other.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        I must have misunderstood.

                        string text = "myTxt/r/n" draws myTxt/r/n
                        string text = "/r/nmyTxt" draws /r/nmyTxt

                        i.e. drawing the text and the escape characters

                        Comment


                          #13
                          Hi dibDab,

                          I think you have used the wrong slashes. Try backslashes instead of forward slashes.

                          Try copying and pasting from post # 4.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            that's perfect, thank you.

                            I'm probably going off topic here but if I use my indicator inside a strategy then the draw labels don't appear but they do if I just use the indicator?

                            Comment


                              #15
                              Hello dibDab,

                              Are you calling AddChartIndicator()?
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Chuso, 01-14-2025, 03:41 AM
                              4 responses
                              22 views
                              0 likes
                              Last Post Chuso
                              by Chuso
                               
                              Started by steinberg123, 01-09-2025, 05:48 AM
                              3 responses
                              40 views
                              0 likes
                              Last Post steinberg123  
                              Started by Mindset, 01-14-2025, 05:33 AM
                              2 responses
                              12 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by steinberg123, Today, 02:43 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post steinberg123  
                              Started by r68cervera, Today, 02:22 AM
                              0 responses
                              7 views
                              0 likes
                              Last Post r68cervera  
                              Working...
                              X