Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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:	155
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 unpronounceable1700, Today, 04:53 AM
                              1 response
                              19 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by ninza33, Today, 07:26 AM
                              1 response
                              11 views
                              0 likes
                              Last Post NinjaTrader_Zachary  
                              Started by gyilaoliver, Today, 03:31 AM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by RISKYBUSINEZZ, Yesterday, 09:09 PM
                              2 responses
                              14 views
                              0 likes
                              Last Post RISKYBUSINEZZ  
                              Started by RISKYBUSINEZZ, Yesterday, 09:17 PM
                              2 responses
                              9 views
                              0 likes
                              Last Post RISKYBUSINEZZ  
                              Working...
                              X