Support Board
Date/Time: Sun, 08 Sep 2024 00:37:50 +0000
ACSIL Drawing Question
View Count: 2171
[2015-10-23 15:03:09] |
User55519 - Posts: 37 |
Hello, I'm new to ACSIL and not a serious programmer so please excuse any ridiculous mistake I may have made here. I'm most of the way there, but I'm missing something. What I'm doing is finding a price bar on a chart that meets certain criteria (call it Bar1), then finding another one nearby that meets other criteria (Bar2). What I want to do, but am struggling with is this: Bar2 is always going to be older/further left on the chart than Bar1. I want to draw a rectangle from Bar2 to Bar 1. The code I'm using does this but only for the MOST RECENT instance that Bar2 and Bar1 exist. The code I'm working with below, if I replace it with drawing code that puts an ARROWDOWN on every price bar between Bar2 and Bar1, it works. It works for all instances of Bar2 and Bar 1 on the entire chart. When I use the rectangle code, only the most recent instance is drawn. Any idea what I'm missing? I've surrounded the important bit (I think) by slashes below. Thanks for any help! static const int UniqueLineNumber = (sc.ChartNumber+sc.StudyGraphInstanceID)*1000; s_UseTool Tool; Tool.Clear(); Tool.ChartNumber = sc.ChartNumber; Tool.DrawingType = DRAWING_RECTANGLEHIGHLIGHT; Tool.LineNumber = UniqueLineNumber + 2; /////////////////////////////////////////////////////// Tool.BeginIndex=Bar2; Tool.EndIndex=Bar1; Tool.BeginValue=Open[Bar2]; Tool.EndValue=Close[Bar2]; ////////////////////////////////////////////////////// Tool.Color = RGB(255,0,0); // Red Tool.LineWidth = 1; Tool.SecondaryColor = RGB(0,255,0); // Green Tool.TransparencyLevel = 90; Tool.AddMethod = UTAM_ADD_OR_ADJUST; int res = sc.UseTool(Tool); This is the code I use to produce the arrow. It technically works, but I think I'm not doing this properly. I just run a for loop for all price bars between Bar2 and Bar1. Looks terrible though and is hard to read, hence the need for a shaded rectangle. sc.Subgraph[0].DataColor[BarInterval] = sc.Subgraph[2].PrimaryColor; sc.Subgraph[0][BarInterval] = sc.High[BarInterval]; Date Time Of Last Edit: 2015-10-23 15:08:37
|
[2015-10-23 19:24:10] |
|
When I use the rectangle code, only the most recent instance is drawn.
The problem relates to: Tool.AddMethod = UTAM_ADD_OR_ADJUST; Refer to the documentation for this here: https://www.sierrachart.com/index.php?page=doc/doc_ACSILDrawingTools.html#AddMethod static const int UniqueLineNumber = (sc.ChartNumber+sc.StudyGraphInstanceID)*1000;
Also, this is not the best way to do this. You should let ACSIL assign the LineNumber. Look at the latest code example in /ACS_Source/studies.cpp >> scsf_UseToolExample 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-10-24 08:28:53] |
User55519 - Posts: 37 |
Wow, that was very helpful and straight to the point. The code is working perfectly now, thanks a lot! Can I also please ask if there is source code for ACSIL line drawing somewhere? I'm struggling a bit with that as well. Thanks again! |
[2015-10-26 09:25:00] |
|
This function will show you an example of using the Line drawing tool: /ACS_Source/studies.cpp >> scsf_UseToolExample It has many examples. One for each drawing tool. 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-10-26 09:27:43
|
To post a message in this thread, you need to log in with your Sierra Chart account: