Login Page - Create Account

Support Board


Date/Time: Sat, 18 May 2024 03:51:46 +0000



Post From: DRAWSTYLE_TEXT with vertical offset that works with vertical scaling

[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