Login Page - Create Account

Support Board

Date/Time: Thu, 20 Jun 2024 19:36:16 +0000

[Programming Help] - [Programming Help] Align Center Multiline text

View Count: 198

[2023-05-09 06:09:10]
daniel.lee - Posts: 3
Hi all, currently I draw a SINGLE line of text below a candle by the following snipper

Tool.DrawingType = DRAWING_TEXT;
Tool.BeginDateTime = sc.BaseDateTimeIn[index];
Tool.BeginValue = y + offset;
Tool.TextAlignment = DT_CENTER | DT_TOP;

in which y is the low of a candle, and offset is some constant for the padding. The text is centered in the middle.

now I'd like to add 2 more lines, let's call it Line1, Line2. Currently, I'm stuck at figuring out Y1, Y2 which is the value on Y axis for Line1, Line2. Currently I'm doing a math

Y1 = y + offset + fontsize + somepadding between first line and second line
Y2 = Y1 + fontsize + somepadding between two line and third line

This works for some instruments, some don't. I tried from USD/JPY to BTCUSD. I'm looking for a few possible ways
1. Get previous line Y value
2. Convert some constant value to a Y axis scale.

I attached an image below, it's what I want to achieve

Thank you
imageScreenshot 2023-05-09 at 12.45.15.png / V - Attached On 2023-05-09 06:05:37 UTC - Size: 144.21 KB - 61 views
Attachment Deleted.

To post a message in this thread, you need to log in with your Sierra Chart account:


Login Page - Create Account