Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Text with textAlignment.Right or textAlignment.Left shown on the opposit size

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

    Draw.Text with textAlignment.Right or textAlignment.Left shown on the opposit size

    I am using Draw.Text, with and character is displayed on the wrong side of the bar (left instead of right, and right instead of left)

    Code:
    private const string     openDistrbutionSymbol = "4"; // Ascii code for > in "Webdings"
    private const string     closeDistrbutionSymbol = "3"; // Ascii code for < in "Webdings"
    ...
    fontSymbols = new Gui.Tools.SimpleFont("Webdings", 18);
    ...
    
    private void DrawOpen()
    {
        Draw.Text(this.parent, TagText("Open"), false, openDistrbutionSymbol, this.StartDateTime, this.OpenPrice, 0,
            Brushes.Black, this.parent.fontSymbols, TextAlignment.Left, Brushes.Transparent, Brushes.Transparent, 0); 
    }
    
    private void DrawClose()
    {
        Draw.Text(this.parent, TagText("Close"), false, closeDistrbutionSymbol, BarsToDateTime(this.StartBar+this.BarsCount-1), this.ClosePrice, 0,
            Brushes.Black, this.parent.fontSymbols, TextAlignment.Right, Brushes.Transparent, Brushes.Transparent, 0); 
    }
    Click image for larger version

Name:	Screen Shot 2018-10-15 at 2.44.51 AM.png
Views:	807
Size:	72.8 KB
ID:	1035640

    #2
    Hello Shai Samuel,

    Thanks for your post.

    The alignment is relative to the center of the bar.
    Right justified text will end at the bar center line.
    Left justified text will begin at the bar center line.
    Please see the embedded example where the text is drawn relative to the doji bar center line.

    You would need to reverse your alignment to have the arrow text point to the center of the bar line.

    Click image for larger version

Name:	ShaiS-2.PNG
Views:	801
Size:	45.3 KB
ID:	1035649

    Comment


      #3
      Good afternoon, I have the problem that the text comes out too far to the left and I want to see it more together with the price. The text comes out centered but it appears to me very separated from the bar. My purpose is that it is more linked to the price bar. How could I solve it?

      Thanks a lot.




      if(ShowTime)
      {
      Draw.Text(this,"TFx"+CurrentBar, true, Convert.ToString(Time[0]),5, Median[0], 0,colorText1,
      new SimpleFont("Small Fonts", 10)/*new Font("Small Fonts", 7, FontStyle.Regular)*/, TextAlignment.Right, Brushes.Transparent,Brushes.Transparent, 0);
      }
      Attached Files

      Comment


        #4
        Hello punkiy2111,

        Thanks for your post.

        To adjust the relationship between the text and the price bars you would want to change the "Y" parameter in your Draw.text(0 statement. The Y parameters shows as "5".

        I would suggest something like Low[0] - 5 * TickSize as the Y value to use, this will place the text 5 price ticks below the low of the bar. You can adjust the number of ticks to what works best for you.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        663 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        376 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        110 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
        580 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X