Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Textoffset for Draw.TextFixed?

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

    Textoffset for Draw.TextFixed?

    Hello,
    I have this code line in my indicator that draws text on my chart whenever the respective alarm is armed:
    Draw.TextFixed(this, "AlertArmed", " FC ALERT ARMED " + "(Distance: " + emaDistance + ")", TextPosition.TopRight, Brushes.White, smallFont, Brushes.Black, Brushes.Purple, 100);

    Now the fixed position TopRight is not always ideal. So it is possible to set an Textoffset (eg. 100 pixels to the left) ?

    Haven´t found anything about that in the online manuals nor here in the forum.
    Also I don´t know if the classical Draw.Text would work for this?

    Thanks for the help
    Peter

    #2
    Hello cyberpete76,

    Thank you for your note.

    There is no way to apply an offset with the Draw.TextFixed() method. That being said, NinjaTrader 8 uses SharpDX for custom rendering and you could add your own custom rendering to the script to draw text at a designated set of coordinates on the chart. The platform includes a SampleCustomRender script which is an example of how custom rendering can be used in a script. When using custom rendering, there are some best practices to keep in mind related to resource usage and performance. The helpful links below include information about custom rendering as well as how to calculate chart coordinates to render your text at:
    Please let us know if we may be of further assistance.

    Comment


      #3
      Thanks a lot Emily! I will check that out.
      P.

      Comment


        #4
        cyberpete76 In addition to the various choices for TextPosition, it may (or may not) suit your purposes to add spaces to the start or end of your text. This will visually push it one way or the other, and may provide a suitable "gap" for you. Even adding blank lines can push the text in the direction you want. Simple and easy to try. If you need something more complex, NinjaTrader_Emily has pointed you in the right direction.

        Thanks.
        Last edited by jeronymite; 02-21-2023, 04:45 PM.
        Multi-Dimensional Managed Trading
        jeronymite
        NinjaTrader Ecosystem Vendor - Mizpah Software

        Comment


          #5
          jeronymite Thanks for the hint. But as I am using the text box background color, it is always placed at the same point to the right independently of the text spaces. Actully putting text space to the right (at the end of my text) does not move the text to the left.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          633 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          364 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          567 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          568 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X