Support Board
Date/Time: Sun, 22 Dec 2024 23:13:55 +0000
Draw line with ACSIL question.
View Count: 2565
[2015-04-09 15:12:41] |
marcovth - Posts: 61 |
Hello ... Say, you draw a vertical line (on the same bar) with ACSIL from price=0 to price=100. With a line width=1, the line's high is exactly 100, and the line's low is exactly 0. However, if the line-width is e.g. 25, the line's high could become 110, and the line's low could become -10. The larger the line-width, the difference from the expected high and low. I hope you follow me :) Is there a setting in ACSIL that would force a line to use the given BeginValue and EndValue, no matter the LineWidth ? Thanks for your replies. |
[2015-04-09 16:55:36] |
Sierra Chart Engineering - Posts: 104368 |
This has to do with the fact that the line would use rounded edges. It has to do with the pen being used and how the operating system draws it. Instead look at using the "Bar" Draw Style: https://www.sierrachart.com/index.php?page=doc/doc_ChartStudies.html#DrawStyle 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 Date Time Of Last Edit: 2015-04-09 16:57:43
|
[2015-04-09 17:20:54] |
marcovth - Posts: 61 |
These are not user drawn pen lines. These are ACSIL DRAWING_LINEs I am talking about. There are no rounded edges when you use .SquareEdge=1; Lines.Clear(); Lines.ChartNumber = sc.ChartNumber; Lines.DrawingType = DRAWING_LINE; Lines.LineNumber = num; Lines.BeginDateTime = sc.BaseDateTimeIn[bar1]; Lines.BeginValue = val1; Lines.EndDateTime = sc.BaseDateTimeIn[bar2]; Lines.EndValue = val2; Lines.Color = Color; Lines.LineWidth = LineWidth; Lines.LineStyle = LineStyle; Lines.AddMethod = UTAM_ADD_OR_ADJUST; Lines.SquareEdge=1; Lines.Region = Region; sc.UseTool(Lines); Lines.DrawingType = DRAWING_BAR; ... gives an error. When SC is drawing thick volume bars with its volume study, you get the expected volume heights. However, if you draw the same volume bars as a DRAWING_LINE with ACSIL, the line differs in size depending on LineWidth you are using. This is because SC is drawing edges around a DRAWING_LINE. There seems to be an ACSIL "DrawEndingEdges=false" option missing to draw a DRAWING_LINE exactly between the given BeginValue and EndValue, no matter what LineWidth it it using. I hope you can add this DrawEndingEdges=false option to the programming list. Thanks in advance. Date Time Of Last Edit: 2015-04-09 17:25:51
|
[2015-04-10 12:55:25] |
marcovth - Posts: 61 |
When you draw a horizontal DRAWING_LINE as above, is there a trick that would translate sc.TickSize into Lines.LineWidth ? If you have a lot of prices between sc.ChartRegion1TopCoordinate and sc.ChartRegion1BottomCoordinate, the LineWidth will have to be smaller than when you zoom in and you have less prices in the price chart. Is there a fixed number of pixels per LineWidth unit, and if so, what is that number? Date Time Of Last Edit: 2015-04-10 13:02:45
|
[2015-04-10 13:49:40] |
marcovth - Posts: 61 |
I am answering my own question for others to use ... this seems to work fine for me ... float topPrice=sc.YPixelCoordinateToGraphValue(sc.ChartRegion1TopCoordinate); float botPrice=sc.YPixelCoordinateToGraphValue(sc.ChartRegion1BottomCoordinate); float MiddlePrice=(topPrice+botPrice)/2.0f; float P1px=sc.RegionValueToYPixelCoordinate(MiddlePrice,0); float P2px=sc.RegionValueToYPixelCoordinate(MiddlePrice-sc.TickSize,0); float PixelsPerTickSize=P2px-P1px; int LineWidthPerTickSize=(int)(PixelsPerTickSize-2.0f); Remember, this calculates the LineWidth per TickSize for the Price Window, and not for a study frame. |
[2015-04-14 04:29:48] |
Al SC Developer - Posts: 434 |
In the next version, there is a new variable in the s_UseTool class called FlatEdge. When this is set, line drawings are drawn with a flat end.
|
[2015-05-11 16:01:49] |
marcovth - Posts: 61 |
Hello ... Was FlatEdge implemented already in the latest version? If so, it doesn't seem to work for me. [IMG]http://i60.tinypic.com/fdugbb.png[/IMG] Lines.Clear(); Lines.ChartNumber = sc.ChartNumber; Lines.DrawingType = DRAWING_LINE; Lines.LineNumber = num; Lines.BeginDateTime = sc.BaseDateTimeIn[bar1]; Lines.BeginValue = val1; Lines.EndDateTime = sc.BaseDateTimeIn[bar2]; Lines.EndValue = val2; Lines.Color = Color; Lines.LineWidth = LineWidth; Lines.LineStyle = LineStyle; Lines.AddMethod = UTAM_ADD_OR_ADJUST; //Lines.AddAsUserDrawnDrawing = 1; Lines.SquareEdge=1; Lines.FlatEdge=1; Lines.Region = Region; sc.UseTool(Lines); |
[2015-05-11 16:06:37] |
Al SC Developer - Posts: 434 |
Do not turn on SquareEdge, that is overriding the FlatEdge option.
|
To post a message in this thread, you need to log in with your Sierra Chart account: