Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawText not working

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

    DrawText not working

    What would stop DrawText or DrawDiamond from placing the text/marker on price BESIDES DrawOnPricePanel (which equals true) ??

    It is frustrating because the exact same code in other places does work. Yet this does not:
    Code:
     DrawOnPricePanel = true; 
     Font     ptFont = new Font("Arial", 8, FontStyle.Regular, GraphicsUnit.Point);
     DrawText("test", AutoScale, "NOW", 0, Close[0], 0, Color.Black, ptFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 10 );
    I can get alerts and output print statements, but nothing on the chart.
    I've done this many times before, so it is really bugging that I am missing something.

    #2
    Lost Trader, we'll take a look into this and get back to you.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Please check Control Center logs for errors.

      DrawOnPrice panel should be in Initialize(). DrawText should be in OnBarUpdate().
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        No errors in the log.

        It has never been an absolute REQUIREMENT that DrawOnPricePanel be ONLY in the Initialize method. It works in OnBarUpdate() when needed in an indicator that first draws on Price (set to true) and later in the indicator panel (set to false), all within OnBarUpdate().

        There must be something else, because this is not logical.

        Comment


          #5
          Please provide the complete script then for us to examine on our end.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            kind of figured you would say that. However, it is part of a larger package which I am not allowed to upload.

            Let me know if anything comes to mind. . .

            Comment


              #7
              Try with the simpler signature:

              DrawText(string tag, string text, int barsAgo, double y, Color color)

              That will remove the complexity of the Font.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                I tried
                DrawText("tag1", "Text to draw", 0, High[0], Color.Black);
                and DrawDiamond and DrawTriangleUp but still no output.

                What's really wierd is that there is NO output ANYWHERE, in any panel.
                If it were because of DrawOnPricepanel, then you would think the text would show up in the indicator window, but it isn't there either.

                Comment


                  #9
                  Lost Trader,

                  Check your Control Center logs for errors. All I can suggest is for you to strip down your code to bare basics and try again. Then slowly add layers of complexity till you find where it breaks.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    As I indicated below, there are no errors in the log.

                    By working on a blank chart, with just the test code, I discovered that placing the DrawOnPricePanel immediately after the last Draw command to the indicator panel vs. right before the Draw command to the price panel, changed the behavior (it worked) tho it should not matter, as long as the command is before the Draw instruction.

                    However, it still was not working on the original workspace. I know that if a plot command is changed, it is necessary to remove the indicator from the chart and re-apply it. This has never been necessary when only changing calculations or Draw statements. But since it now worked for certain on a new chart, I removed it completely from the original and re-applied. To get indicators back in sequence, this meant pulling everything off and rec-creating the chart completely.

                    At least it is now writing as it should.

                    Comment


                      #11
                      Using DrawOnPricePanel outside of Initialize() is not recommended. Any behavior of such is beyond what we can support.
                      Josh P.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by MaybellMcKee, Today, 10:18 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post MaybellMcKee  
                      Started by Lance El Camino, Today, 04:14 PM
                      1 response
                      12 views
                      0 likes
                      Last Post s.kinra
                      by s.kinra
                       
                      Started by jtrading82, Today, 04:56 PM
                      1 response
                      8 views
                      0 likes
                      Last Post NinjaTrader_ShawnB  
                      Started by dmking, Today, 06:00 PM
                      1 response
                      6 views
                      0 likes
                      Last Post NinjaTrader_EricB  
                      Started by WHICKED, Today, 03:23 PM
                      1 response
                      12 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Working...
                      X