Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Lock text on the right side of chart

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

    Lock text on the right side of chart

    How can I lock a text object on the right side of the chart?

    So that it's Y position is fixed but moves on the X axes.

    #2
    Hello symphys,

    Thank you for your post.

    Unfortunately, this is not possible with the drawing tools presently as they will tied to the specific place on the chart.

    I will forward your suggestion to have text move with the time axis to be added to the list of the possible future enhancements to NinjaTrader.

    Another thing, is that NinjaTrader 7 will include many drawing tool enhancements. Please see the following link.
    Ryan O.NinjaTrader Customer Service

    Comment


      #3
      symphys,

      Code-wise you could create an indicator and use DrawTextFixed() and fix it to the right corners of the screen.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Hey Symphys, did you ever get an indicator built to accomplish this? I have been trying but no luck. I would like to build an indicator that would display "Only Long" or "Only SHort" in the top right hand corner based on a true or false selection I make.

        I have limited programming abilities..

        If there is an example of an indicator that included this that I can edit I would be interetsed to be pointed in that direction.

        Comment


          #5
          Hi Stalt,

          Thank you for your post.

          There is not really an indicator, but you can reference the following link for creating an indicator with those values.
          Ryan O.NinjaTrader Customer Service

          Comment


            #6
            I read that but as I said I have limited programming knowledge and have no idea where to place that in the code to make it wirk.

            If I have a bool line I would like a true value to place an only long lable...if it is false I would like an only short label....but I can't figure out whre to put the

            // Draws text in the upper right corner of panel 1
            DrawTextFixed("tag1", "Text to draw", TextPosition.TopRight);

            in the script to make it work.

            Comment


              #7
              Hello Stalt,

              You can use the indicator wizard to create a public bool input. This is the true / false selection.

              Use the wizard to add a public input called MyBool.

              You can then use the snippet below to draw whether or not this is true or false.

              Code:
               
              if (MyBool)
              DrawTextFixed("myTagTrue", "myTextTrue", TextPosition.TopRight);
               
               
              else
              DrawTextFixed("myTagFalse", "myTextFalse", TextPosition.TopRight);
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                Got it figured!


                Thanks!

                Comment


                  #9
                  ok sorry for another dumb question....HOw can I change the font size and color. If I color.red behind the topright indication I get erroes.

                  I would like to increase the font and have it all caps as well as have the font green if true and red if false.

                  Comment


                    #10
                    stalt,

                    You have to use the other method signature for this.


                    Example:
                    Code:
                     
                    DrawTextFixed("MYTAGTRUE", "MYTEXTTRUE", TextPosition.TopRight, Color.Green, new Font("Arial", 12), Color.Green, Color.Transparent, 0);
                     
                    DrawTextFixed("MYTAGFALSE", "MYTEXTFALSE", TextPosition.TopRight, Color.Red, new Font("Arial", 12), Color.Red, Color.Transparent, 0);
                    Ryan M.NinjaTrader Customer Service

                    Comment


                      #11
                      Thanks a million Ryan for posting that syntax. Don't ever think a question is too simple to take the time.

                      Because it is posted here, I eventually found it, and although I am no programmer, if I have something that works like this, I can play around with it and eventually hack my way to what I want.

                      The example given in the Docs, and in the reference sample...which doesn't show DrawtText at all... are so simple they are useless.

                      By answering that one question, me and a hundred like me will dig deep, find your post and answer their own question.

                      Thanks again..... five minutes playing around with that example and now I can make that dog dance to my fiddle.

                      Comment


                        #12
                        Thanks for the feedback, Crassius. I appreciate the kind words.
                        Ryan M.NinjaTrader Customer Service

                        Comment


                          #13
                          Hi guys this is a good thread.

                          However I have zero c# and I inserted the code randomly in the code generated by the wizard.

                          It comes up with these two errors - ") expected" and "Class Member declaration" expected.

                          I pasted this DrawTextFixed("tag1", "Text to draw", TextPosition.TopRight);

                          just above where #region properties is. (using NT 6.5) I have no clue where to paste it. Or any extra coding I need to do. (full code will help; so that i can just paste it)

                          Furthermore, how does it allow me to enter what text I want fixed. Do I enter it within the code or when I add the indicator it allows me to enter it then?

                          Thanks in advance for your help.

                          Comment


                            #14
                            Hello nicoacademia,

                            Thank you for your post.

                            Most of the code snippets you'll see posted here belong in OnBarUpdate() method, in-between the two curly brackets { }

                            You can edit any existing indicator through tools > edit NinjaScript window to see how they're structured.

                            There is also a guide available for indicator development, which goes through the purpose of each method:
                            Ryan M.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by arvidvanstaey, Today, 02:19 PM
                            4 responses
                            11 views
                            0 likes
                            Last Post arvidvanstaey  
                            Started by samish18, 04-17-2024, 08:57 AM
                            16 responses
                            61 views
                            0 likes
                            Last Post samish18  
                            Started by jordanq2, Today, 03:10 PM
                            2 responses
                            9 views
                            0 likes
                            Last Post jordanq2  
                            Started by traderqz, Today, 12:06 AM
                            10 responses
                            18 views
                            0 likes
                            Last Post traderqz  
                            Started by algospoke, 04-17-2024, 06:40 PM
                            5 responses
                            48 views
                            0 likes
                            Last Post NinjaTrader_Jesse  
                            Working...
                            X