Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 07:49:12 +0000



[Programming Help] - DRAWSTYLE_TEXT with vertical offset that works with vertical scaling

View Count: 1046

[2020-04-20 20:08:08]
User317354 - Posts: 5
I would like to use DRAWSTYLE_TEXT with an offset amount. Something like this:

subgraph_myText[sc.Index] = sc.BaseData[SC_HIGH][sc.Index] * 1.005f;

However, above method doesn't stay "relatively in place" when the graph is vertically scaled, the text would "fly away" from the candlestick bars. Because the offsetting is in "price amount" instead of "pixel" or "text size", the offset would be scaled as vertical scaling happens.

Alternatively, use sc.AlwaysUpdate = 1 and keep adjusting the (price) offset amount with sc.BarIndexToXPixelCoordinate()/sc.YPixelCoordinateToGraphValue() works but results a very laggy chart. Similarly, using sc.UseTool() to draw the text with multi-line mode (to mimic a pixel offset effect) cause laggy chart because of the amount of drawing happens (even only draw for visible area with sc.IndexOf(First/Last)VisibleBar).

I am looking to achieve an effect like what DRAWSTYLE_CUSTOM_VALUE_AT_Y does when subgraph.Array[1][] is set with an offset, but for TEXT instead of numbers. What should I do?
Date Time Of Last Edit: 2020-04-20 20:17:52
[2020-04-22 01:39:37]
User317354 - Posts: 5
Why this is moved to programming help? IMO sierra chart really missing a necessary DRAWSTYLE to achieve this.
Date Time Of Last Edit: 2020-04-22 02:01:42
[2021-02-18 18:53:14]
User79074 - Posts: 105
Please add this feature
[2021-02-18 19:41:09]
John - SC Support - Posts: 31362
You do not need a feature added for this. Just offset the amount by a set number of ticks rather than a percentage of the price. You have access to the Tick Size for the chart.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2021-02-19 05:01:53]
User317354 - Posts: 5
Hi John,

Respectfully the initial post mentioned using tick is possible today but when the chart is zoomed in vertically, using tick for offset will cause the pixel distance to increase, resulting the text to “fly away” from the bars.
[2021-02-19 07:45:28]
User79074 - Posts: 105
With all due respect, offsetting via tick offset and the offset you provided with DRAWSTYLE_CUSTOM_VALUE_AT_Y are completely different. The labels using tick offset and the labels using the offset provided with DRAWSTYLE_CUSTOM_VALUE_AT_Y do not line up when using DRAWSTYLE_TRANSPARENT_TEXT and DRAWSTYLE_CUSTOM_VALUE_AT_Y combined. Please don't try to get out of doing this fix. Since you implemented this for DRAWSTYLE_CUSTOM_VALUE_AT_Y, you should also implement this for DRAWSTYLE_TRANSPARENT_TEXT. Thank you.
[2021-03-05 11:56:54]
User79074 - Posts: 105
Please address this!! As previously said "method doesn't stay "relatively in place" when the graph is vertically scaled, the text would "fly away" from the candlestick bars." So adjusting via tick offset is not the proper solution.

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

Login

Login Page - Create Account