Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawText() in white space

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

    DrawText() in white space

    Greetings!

    I'm determined to clean up my charts and as part of that I want to have labels for horizontal lines which my strategy draws appear in white space (i.e. not obscured by bars). I have now set up my default chart with a right margin of 150 pixels (Chart Properties | Right Side Margin) so I have my white space available.

    My question is, how can I use DrawText to access that space?

    For example: my strategy has created a line which shows my entry price. I'd like it to be labelled as "Entry=100.99". Currently, I'm using the following code:

    DrawText(stub + "Text",true,"Entry=" + value,0,value,10,Color.Black,new Font("Arial",12),StringAlignment.Far,Color.Transpa rent,Color.Transparent,0);

    This puts the text 10 bars back, but inevitably it is buried in other bars or markings.

    How can I move that to the RIGHT of the current bar (and into the margin that I have created expressly for that purpose)?

    Thanks as always.

    #2
    Originally posted by cmt_Robert View Post
    Greetings!

    I'm determined to clean up my charts and as part of that I want to have labels for horizontal lines which my strategy draws appear in white space (i.e. not obscured by bars). I have now set up my default chart with a right margin of 150 pixels (Chart Properties | Right Side Margin) so I have my white space available.

    My question is, how can I use DrawText to access that space?

    For example: my strategy has created a line which shows my entry price. I'd like it to be labelled as "Entry=100.99". Currently, I'm using the following code:

    DrawText(stub + "Text",true,"Entry=" + value,0,value,10,Color.Black,new Font("Arial",12),StringAlignment.Far,Color.Transpa rent,Color.Transparent,0);

    This puts the text 10 bars back, but inevitably it is buried in other bars or markings.

    How can I move that to the RIGHT of the current bar (and into the margin that I have created expressly for that purpose)?

    Thanks as always.
    Use a negative index for the barsAgo parameter. You may also want to use StringAlignment.Near instead of StringAlignment.Far.

    Comment


      #3
      So intuitive...and yet I never thought to try it! Thank you!!

      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