Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is Draw.Text(...) working?

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

    Is Draw.Text(...) working?

    I have Draw.TextFixed(...) working -- the short form fails, but the long form works if I follow it with RemoveDrawObject(""); to force a screen refresh (hack, I know -- suggest a better way).

    I cannot make Draw.Text(...) work, though -- either long or short form. Here is my code. I'd appreciate knowing what I am doing wrong. The Draw.TexFixedt(...) line works, but neither of the Draw.Text(...) lines work.

    Code:
                Draw.Text(this, "Testing", "TESTING TEXT", 0, 200);
                Draw.Text(this, "MoreTesting", false, "MORE TEST TEXT", 0, 300, 0, Brushes.Black, new SimpleFont("Arial", 12), TextAlignment.Center, Brushes.Black, Brushes.Transparent, 0);
                Draw.TextFixed(this, tag+"Fixed", barNumber.ToString(), TextPosition.Center, Brushes.Black, new SimpleFont("Arial", 16) { Bold = true }, Brushes.Transparent, Brushes.Transparent, 0);
                RemoveDrawObject("");               // Kludge to force a chart redraw
    --EV

    #2
    Working here. The double y overload is a price value, not a chart scale coordinate (if that's what you were expecting). Try setting the auto scale overload to true, or change the y value to Close[0] and let me know if it's still not working for you
    MatthewNinjaTrader Product Management

    Comment


      #3
      Originally posted by NinjaTrader_Matthew View Post
      Working here. The double y overload is a price value, not a chart scale coordinate (if that's what you were expecting). Try setting the auto scale overload to true, or change the y value to Close[0] and let me know if it's still not working for you
      No luck yet. I did set the long form autoscale to true. I set Y to a price that is in the middle of the chart I am testing on. (Close[0] gives a bad answer -- I posted another thread about that.) 2000 and 2500 make sense -- the chart is showng ^SPX, and the price scale ranges from 1970-2140
      Code:
                  Draw.Text(this, "Testing", "TESTING TEXT", 0, 2000);
                  Draw.Text(this, "MoreTesting", true, "MORE TEST TEXT", 0, 2500, 0, Brushes.Black, new SimpleFont("Arial", 12), TextAlignment.Center, Brushes.Black, Brushes.Transparent, 0);
      What worries me is that I am doing this from OnMouseMove() -- the same place where Close[0] reports the value for the very first (i.e. scroll all the way left) bar. Perhaps it is trying to plot there, too -- which would be way off the chart.

      I wonder whether the most productive thing is to understand the problem I am having with Close[0] first? Do you also see a problem with Close[0] in OnMouseMove(), or is that something peculiar to my setup? Does your Draw.Text(...) work from OnMouseMove()?

      --EV

      Comment


        #4
        Actually, I apologize, there was an issue with Draw.Text() short overload where the text color was not set which is what you may be seeing: NTEIGHT-8553

        But your long form "MoreTesting" should be working in B3 as long as you have set the brush color (as you're doing).

        I have not had time to test OnMouseMove() yet, but I can confirm your method is working from OnBarUpdate().

        edit: As a tip, try going to the Charts drawing tool menu and select "Drawing objects"... which should give you a list view of any objects and their properties to see if they're actually being called and inspect their values.
        MatthewNinjaTrader Product Management

        Comment


          #5
          Originally posted by NinjaTrader_Matthew View Post
          Actually, I apologize, there was an issue with Draw.Text() short overload where the text color was not set which is what you may be seeing: NTEIGHT-8553

          But your long form "MoreTesting" should be working in B3 as long as you have set the brush color (as you're doing).

          I have not had time to test OnMouseMove() yet, but I can confirm your method is working from OnBarUpdate().
          .
          Close[0] gives the correct value from OnBarUpdate() too ... but gives the wrong value from OnMouseMove(). I'm suspicious that my Draw problem is related.

          --EV

          Comment


            #6
            Originally posted by NinjaTrader_Matthew View Post
            edit: As a tip, try going to the Charts drawing tool menu and select "Drawing objects"... which should give you a list view of any objects and their properties to see if they're actually being called and inspect their values.
            Thanks, and I am back on track now. It does work from OnMouseMove(). I did notice one oddity, though. Autoscale is on in the call (as you can see from the last code I posted). When I look up the Drawing Objects, as you suggested, autoscale is off. If I turn it on in the DO dialog and Apply, it works. Is it a bug that the "true" in the Draw.Text call is evidently getting ignored?

            --EV

            Comment


              #7
              I just retried autoscale to confirm -- it does not matter whether I set it on or off, the autoscale box in the Drawing Objects dialog is unchecked. Sounds like a bug?

              Question: I am setting the outline brush to Black. What result should I be seeing? I thought it would outline the textbox, but I see no visual effect. What should I be seeing?

              --EV

              Comment


                #8
                Still experimenting -- I set the background so I could see the area. I found out why my outline is not showing. The Drawing Objects dialog has an "Outline - enabled" checkbox, which is not checked. How do I make my call so that drawing the outlline will be enabled?

                --EV

                Comment


                  #9
                  Something else I would consider a bug -- the text message is allowed to have leading whitespace, but any trailing whitespace is trimmed. Please do NOT trim whitespace -- I would not have it there in my string if I did not want it displayed!

                  --EV

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by ftsc2022, 10-25-2022, 12:03 PM
                  5 responses
                  255 views
                  0 likes
                  Last Post KeyonMatthews  
                  Started by ScottW, Today, 06:09 PM
                  0 responses
                  2 views
                  0 likes
                  Last Post ScottW
                  by ScottW
                   
                  Started by Board game geek, 10-29-2023, 12:00 PM
                  14 responses
                  244 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by Waxavi, 04-19-2024, 02:10 AM
                  4 responses
                  56 views
                  0 likes
                  Last Post sonia0101  
                  Started by cmtjoancolmenero, Today, 03:58 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post cmtjoancolmenero  
                  Working...
                  X