Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawTextFixed

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

    DrawTextFixed

    Hello,

    I would like to print some values on the price chart from my strategy. Looking through documentation, it seems that DrawTextFixed could work:
    DrawTextFixed("Pressure: ", dPressure.ToString("#.00"), TextPosition.BottomRight);
    But nothing is showed. Is it the right way to do that? Also, I miss the window/chart handler, where does this function write?

    Regards

    #2
    Hello,

    Yes, this should work as long as the condition is true. Where did you put DrawTextFixed?

    Does DrawTextFixed work if you use the sample from our Documentation?

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

    This will write in the panel you have specified. You can use DrawOnPricePanel = true; to force it to draw in the first panel.
    MatthewNinjaTrader Product Management

    Comment


      #3
      I think that is the problem. How can I specify the panel?

      Thank you!

      Comment


        #4
        Hello,

        Sorry for the confusion - if you're doing this form a strategy you can only draw on the price panel.

        With an indicator you would have the option to specify the price panel.

        Where are you using DrawTextFixed in your code? Is this condition true at all times?
        MatthewNinjaTrader Product Management

        Comment


          #5
          Hello,

          It is used on every OnMarketData event.
          Need I specify the default panel or something like that?
          Do I need setup any properties on Initialize()?

          Comment


            #6
            Hello,

            You should not need to set this up in Initialize(). There are no strategy properties related to drawing and will draw on the default panel.

            If you're unable to Draw this information, are you able to Print() it to the output window as a test?
            MatthewNinjaTrader Product Management

            Comment


              #7
              Yes, I can print it on the window with Print(); also, rest of code works fine with this value.
              I have tested the sample code and it does't work, my code looks somethink like this:

              protected override void OnMarketData(MarketDataEventArgs e)
              {
              ...
              case MarketDataType.Last:
              DrawTextFixed("tag1", "Text to draw", TextPosition.TopRight);
              ...
              }

              Comment


                #8
                Can you try doing this just in OnBarUpdate just to see?

                I've ran this in OnMarketData using the following and it works for me:

                Code:
                protected override void OnMarketData(MarketDataEventArgs e)
                		{
                		switch(e.MarketDataType)
                			{
                		
                		case MarketDataType.Last:
                		DrawTextFixed("tag1", "Text to draw", TextPosition.TopRight);
                				break;
                			}
                		
                		}
                MatthewNinjaTrader Product Management

                Comment


                  #9
                  I have tested it in OnBarUpdate and it still doesn’t work.
                  I only need have opened a Char window (price type) on the same instrument, isn’t it?

                  Regards

                  Comment


                    #10
                    From where do you start your strategy? From the chart or strategies tab in NT?

                    If done from the strategies tab > it would not be visualized.

                    Comment


                      #11
                      Ahh! It was from the strategy tab. So, How must be done from strategy? Is it possible print something to a chart from the strategy tab?

                      Thank you

                      Comment


                        #12
                        To use the drawing features for the strategy, please start it simply from your chart - right click on the chart and you can add a strategy as well.

                        Unfortunately you could not print info to the strategies tab, only to your output window or the log -



                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        670 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        379 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        111 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        575 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        582 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X