Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change color within a text of Draw.TextFixed

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

    Change color within a text of Draw.TextFixed

    Hello,

    is it possible to change the color of a string within Draw.TextFixed using a special sequence like \xxx?

    Gerik

    #2
    Hello Gerik,

    Thanks for you post.

    No, the string within a Draw.TextFixed() can only be the color as assigned by the method or the default text color.

    You can create sequences of Draw.TextFixed() where each method use can be assigned a different color. I've attached a working example of this that displays the current bar values in the upper right corner as shown in the attached picture.

    Click image for larger version  Name:	Gerik-1.PNG Views:	173 Size:	21.5 KB ID:	1083822

    DrawTextFixedColorExample.zip
    DrawTextFixedColorExample.zip
    Last edited by NinjaTrader_Jim; 11-06-2020, 08:23 AM.

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello Gerik,

      Thanks for you post.

      No, the string within a Draw.TextFixed() can only be the color as assigned by the method or the default text color.

      You can create sequences of Draw.TextFixed() where each method use can be assigned a different color. I've attached a working example of this that displays the current bar values in the upper right corner as shown in the attached picture.

      Click image for larger version

Name:	Gerik-1.PNG
Views:	1161
Size:	21.5 KB
ID:	1083822

      [ATTACH]n1083823[/ATTACH]
      Hi Paul,
      Can you attach sample of a script below, as I have same problem.

      Comment


        #4
        Hello Againmain1,

        It looks like there was an issue with Paul's attachment. Please let us know if you are still having issue downloading it.

        Comment


          #5
          Piggy-backing here, but do you have any examples of assigning the color of these text values based on some logic (if Close is higher than Open color is Green, etc.), where each line of text in your example has its own logic?

          Comment


            #6
            Hello EminiTrader,

            Thanks for your post.

            Here is an example (i modified a line in the example in post #2, mod is shown in bold

            Draw.TextFixed (this, "testa1", opn+" ", TextPosition.TopRight, (Close[0] > Open[0] ? Brushes.Green : Brushes.Red), chartFont, Brushes.Transparent, Brushes.Transparent,20 );

            Here is a short supporting video: https://Paul-ninjaTrader.tinytake.co...M18xNjY1MTg0NQ

            Comment


              #7
              Perfect! Thank you.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              599 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              344 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
              558 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              557 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X