Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.TextFixed in Indicator Pane

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

    Draw.TextFixed in Indicator Pane

    Hi,

    Using the Draw.TextFixed example from the help guide and adding it to an indicator how do I draw the text in the indicator pane?

    Draw.TextFixed(this, "tag1", "Text to draw", TextPosition.TopRight);

    Using "this" draws it in the main chart pane.

    Thanks

    #2
    Hello tmfdouglas,

    Thanks for your post.

    In the indicator, you would need to set the property DrawOnPricePanel = false in State.SetDefaults. Please see: http://ninjatrader.com/support/helpG...pricepanel.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Paul, that's fixed it.

      Comment


        #4
        Another related question....

        Can I set the text to be different colours within the txt string, so for example I want the text to be:

        USD GBP CAD

        If I can't do this using Draw.TextFixed what is the best way?

        Thanks

        Comment


          #5
          Hello tmfdouglas,

          Thanks for your post.

          You would not be able to accomplish this with Draw.TextFixed() because there can only be one brush color for the string to print.

          You would need to use custom plotting. An example in your Ninjatrader would be the indicator "SampleCustomRender" which demonstrates what would be required for custom plotting. It is documented with a number of comments in the code to help understand.
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Thanks, I'll take a look.

            In case there's a simpler solution is it possible to write the values which the indicator is plotting (using the same colours as the plot line) anywhere on the chart? (I'm thinking next to the text which states what indicator it is).

            Comment


              #7
              Hello tmfdouglas,

              Thanks for your reply.

              You might use Draw.TextFixed() and use 3 occurrences, one for each corner of the chart and each with its own color.

              If you have plots that you want the text associated with you could also add a Draw.Text() statement for each plot and use a future bar as a location that will print the text to the right of the plot line (you will need to increase the charts right side margin to see the text). A future bar would be like -2 or any negative value. I've shown an example in the attached. The text could be colored as needed. (This was a Draw.Text() statement added to a copy of the SMA indicator so Value[0] is the Y value of the SMA indicator. I've shown the code statement on the chart as well Using this Draw.Text() method has its disadvantages as when you expand or contract the data time base the text will move just like any candle.
              Attached Files
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Hi Paul,

                I've used the custom render indicator as an example and can colour code and dynamically update the text as intended. The problem now is that the line plots in the indicator no longer draw although the axis markers do, screenshot attached.

                Any advice?

                Thanks
                Attached Files

                Comment


                  #9
                  Hello tmfdouglas,

                  Thanks for your post.

                  I would be unable to advise without seeing the code involved. If possible please attach your source code file for review.

                  Alternatively, please feel free to send into PlatformSupport[at]NinjaTrader[dot]Com, mark the e-mail Atten:Paul and include a link to the thread and attach a copy of the source code file.
                  Paul H.NinjaTrader Customer Service

                  Comment


                    #10
                    Thanks for the quick response.

                    I've emailed you an example indicator which shows the problem.

                    Thanks

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by szferi, Today, 02:04 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post szferi
                    by szferi
                     
                    Started by MidenThur, Today, 12:52 AM
                    0 responses
                    6 views
                    0 likes
                    Last Post MidenThur  
                    Started by seseoraf, Today, 12:51 AM
                    1 response
                    6 views
                    0 likes
                    Last Post charmingishagarg  
                    Started by Rosario, Today, 12:50 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post Rosario
                    by Rosario
                     
                    Started by kemoyums, Today, 12:38 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post kemoyums  
                    Working...
                    X