Support Board
Date/Time: Sun, 08 Sep 2024 01:45:43 +0000
Bug with DRAWING_TRIANGLE ?
View Count: 913
[2015-09-24 19:58:19] |
zencoder - Posts: 10 |
Hi I decided to plot simple triangle. Wrote simple code: s_UseTool t; t.Clear(); t.AddAsUserDrawnDrawing = 1; t.LineNumber = 100000; t.UseRelativeVerticalValues = 0; t.AddMethod = UTAM_ADD_OR_ADJUST; t.DrawingType = DRAWING_TRIANGLE; t.Color = RGB(255,0,0); t.SecondaryColor = RGB(255, 0, 0); t.TransparencyLevel = 30; t.DrawUnderneathMainGraph = 0; int b = sc.ArraySize - 10; int bs = b; float ps = sc.Low[b]; b -= 10; int be = b; float pe = sc.Low[b]; b -= 10; int b3 = b; float p3 = sc.Low[b]; t.BeginIndex = (bs); t.BeginValue = (float)(ps); t.EndIndex = (be); t.EndValue = (float)(pe); t.ThirdIndex = (b3); t.ThirdValue = (float)(p3); sc.UseTool(t); return; Triangle's third corner appears somewhere outside chart (both bar and price values = zero). What is it? I wrote something wrong or it is a bug with DRAWING_TRIANGLE display? SC version 1296 NoCLR Date Time Of Last Edit: 2015-09-24 20:06:08
|
![]() |
[2015-09-24 20:35:18] |
Al SC Developer - Posts: 434 |
This is resolved in the next version. We also added a new example study showing the triangle usage: "UseTool Example: Triangle", source in studies.cpp as scsf_UseToolExampleTriangle().
|
[2015-09-25 06:01:29] |
zencoder - Posts: 10 |
Thanks a lot, I'll wait it. And one more question. I need to place two text boxes so that their backgrounds placed without gap between them. I can chose some Y-values when they become close one to one. But when I change window size, they will move to the new positions and gap will appears or they become overlapped. Is the any way to set drawings coordinates directly in (fixed) pixels and chose one of the 4 window corners as an zero axis origin? Date Time Of Last Edit: 2015-09-25 06:02:15
|
[2015-09-25 20:12:07] |
|
This is quite an advanced question. We really do not know what to suggest other than possibly to use the direct GDI interface: https://www.sierrachart.com/index.php?page=doc/doc_ACSILProgrammingConcepts.html#CustomFreeFormDrawing Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2015-09-26 08:39:18] |
zencoder - Posts: 10 |
We really do not know what to suggest
It's not so complicated - may I try? ))You must add to every tool flag like UsePixelCoordinates. When you (re)draw chart or when it resized, you definitely know its real width and height in pixels (as I hope). So, on redraw or resize event you simply recalculates this "pixel" coordinates to your current "percentage scale coordinates" with simplest formula: x = x / window(chart)width * 150 y = y / window(chart)height * 100 You will get new tools coordinates which is already familiar to your drawing engine - no any modification to last one are not required. The only small code injection before positioning any drawing. Below is example in abstract language: current code: Place(tool, tool.x, tool.y)
changed to:x = tool.x; y = tool.y; if ( UsePixelCoordinates ) { x = x / window(chart)width * 150 y = y / window(chart)height * 100 } Place(tool, x, y) if ( UsePixelCoordinates ) { x = x / window(chart)width * 150 y = y / window(chart)height * 100 Place(tool, x, y) } else Place(tool, tool.x, tool.y) "That's all folks" as it seems to me ;) What do you think about this idea? |
[2015-09-26 10:41:22] |
sampater - Posts: 244 |
add to every tool flag like UsePixelCoordinates
This would be very usufull feature with alignment to the top, bottom, left and right, but set independently for height and width.I have my studies that draw Marker Dash and other markers (see pic) and if i change a window height, then i have to change an input parameter for properly displaying one pixel gap between rows of dashes. Date Time Of Last Edit: 2015-09-26 11:32:00
|
To post a message in this thread, you need to log in with your Sierra Chart account: