Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with draw.text

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

    #31
    Hello guy75,

    Just a follow-up post to conclude this thread.

    We (you and I) worked through the code to produce a workable solution based on https://ninjatrader.com/support/help..._a_ninjasc.htm

    I need to correct my statement in post #24 and state that it is possible for a strategy to create its own indicator panel and send its plots there directly and this is the best solution overall. this ability requires the use of IsOverLay = false; in state.SetDefaults.

    I have attached the test example I sent to you, for the benefit of others who may review this thread.

    The example shows how a strategy can create and plot in its own indicator panel

    StrategyPlotInIndicatorPanel.zip

    Comment


      #32
      Hi Paul, or to anyone out there.

      I am not a code writer in any way whatsoever. And I need your help. Could you make me a script pretty much like the one you
      did titled "DrawtextFixedColorexample". I would like the indicator to be a "fix text indicator" where I can type in text up to 100 characters.

      And have the ability to place it at top-bottom right corners and top-bottom left corners. And with coloring text of my choice.

      Or if you know someone who has such an indicator would you give me their information. or if you have one or more such indicators
      would you give me a link to download them.

      What I what is the ability to type in the text of the template on charts so I know what template the chart is displaying. As I use multiple
      charts this way if I know which template I wish to copy for a top-down analysis.

      I wait for your reply.

      Thank you so much, your efforts are greatly appreciated!

      Sincerely yours
      andrewsforex

      Comment


        #33
        Hi,
        anyone know why my code below can't print the text to chart ?
        Draw.Text(this, "infoBox", string.Format("{0}", "RSI = " + Math.Round(Close[0]*10)/10), 20, -20, Brushes.Yellow);

        however, if I use Draw.TextFixed , it just works fine.
        Draw.TextFixed(this, "infoBox", string.Format("{0}", "RSI = " + Math.Round(Close[0]*10)/10),
        TextPosition.BottomRight,
        Brushes.Yellow, ChartControl.Properties.LabelFont, Brushes.Yellow, Brushes.Transparent, 0);

        thanks !

        Comment


          #34
          Hello judysamnt7,

          Is DrawOnPricePanel set to true or false?

          Is this indicator set to the panel with the chart bars?

          Draw.Text(NinjaScriptBase owner, string tag, string text, int barsAgo, double y, Brush textBrush)

          To confirm you are trying to draw the text 20 bars ago at a price of -20, is this correct?

          Note, this is not using the overload with isAutoScale, so if the text is out of the range of the scale it will not be visible.

          Draw.Text(NinjaScriptBase owner, string tag, bool isAutoScale, string text, int barsAgo, double y, int yPixelOffset, Brush textBrush, SimpleFont font, TextAlignment alignment, Brush outlineBrush, Brush areaBrush, int areaOpacity)

          What range is the panel showing on the price scale?
          Chelsea B.NinjaTrader Customer Service

          Comment


            #35
            Is DrawOnPricePanel set to true or false?

            Is this indicator set to the panel with the chart bars?

            Chelsea, I am not sure how to set above you mentioned.
            Yes, I just want to print RSI value in the same chart as the data series . the coordinate is 20 bars ago and 20 pixels from top of the panel.​

            Comment


              #36
              DrawOnPricePanel and IsOverlay (what panel the indicator is set to display on) is set from within State.SetDefaults.

              Comment


                #37
                Draw.Text(this,"drawtag1",true,"RSI",20,Close[0],-20,
                Brushes.Green,ChartControl.Properties.LabelFont,Te xtAlignment.Center,Brushes.Green,Brushes.LightGray ,80);

                and i am using the full syntax above of Draw.Text and set isAutoScale=true but it is still not printing anything on the chart.​

                Comment


                  #38
                  What are the settings you are using for DrawOnPricePanel and isOverlay?

                  Comment


                    #39
                    just checked that DrawOnPricePanel and isOverlay is set to true at SetDefaults. but even they are false, the text should be drawn on indicator panel, isn't it ?
                    the weird thing, if I am using Draw.TextFixed, it is working just fine

                    Comment


                      #40
                      Hello judysamnt7,

                      That should be fine. Just to confirm, is the drawing not on the chart at all (i.e. not in the list of Drawing objects if you check the list from the chart) or is it just not visible?

                      As Chelsea mentioned, if the text is out of the range of the scale it will not be visible. You're drawing it 20 bars back and at -20 so it may just be out of the visible range.

                      Draw.TextFixed() is always going to draw the text in one of the 4 corners of the chart, so that will always be visible.


                      If the drawing isn't being drawn at all, I recommend debugging using prints. To understand why the script is behaving as it is, such as placing orders or not placing orders or drawing objects when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

                      Add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition.

                      The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.

                      The debugging print output should clearly show what the condition is, what time the conditions are being compared, all values being compared, and how they are being compared.

                      Prints will appear in the NinjaScript Output window (New > NinjaScript Output window)

                      I am happy to assist you with analyzing the output from the output window.

                      Below is a link to a support article that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.

                      https://support.ninjatrader.com/s/ar...nd-TraceOrders

                      Comment


                        #41
                        if 20, -20 is out of range, i tried the following Draw.Text(this, "tag1", "Text to draw", 10, 10, Brushes.Yellow); and it is still visible .
                        do you know what value I should be using to make it within the range? I tried multiple values and none worked.
                        However, the Draw.Textfixed always work. Just so confused.

                        Comment


                          #42
                          You can use smaller values like what you just posted if you want the drawing always in the visible range. Otherwise, as mentioned before, it sounds like the drawing is just drawn too low for you to see it on the chart without having to scroll the chart down.

                          As mentioned, Draw.TextFixed is always going to draw the text in one of the 4 corners of the chart, so that will always be visible.

                          Comment


                            #43
                            there was typo in my last post.
                            actually i did use small values like 10,10 and 0,0 in Draw.Text but still not visible, neither in price panel nor in indicator panel

                            Comment


                              #44
                              Hello,

                              As Chelsea mentioned, that overload doesn't use have the isAutoScale property so it could just be out of range. You haven't confirmed if the drawing isn't on the chart at all, or if it just not visible.

                              Is the drawing not on the chart at all (i.e. not in the list of Drawing objects if you check the list from the chart) or is it just not visible?

                              If you find it in the list of Drawing objects, check the 'Auto scale' box.

                              Comment


                                #45
                                hi thanks.
                                what's the purpose of isAutoScale ? Show the indicator and price simultaneously?
                                It is checked on.
                                So i guess the issue might be caused by the Anchor Time, which is in year 1800 . But how do I modify the time in the code?

                                Click image for larger version

Name:	Screenshot 2025-01-09 142744.png
Views:	67
Size:	181.7 KB
ID:	1330313

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                581 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                338 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                103 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                554 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                552 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X