Support Board
Date/Time: Mon, 10 Feb 2025 16:04:43 +0000
[Programming Help] - Change Line width for threshold with ACSIL
View Count: 934
[2020-08-25 15:01:37] |
User681150 - Posts: 62 |
i was successfully able to change the color of the subgraph line using ACSIL .DataColor when a condition was met (stoch > 60). i assume this was possible because .DataColor has the [sc.Index] capability sc.Subgraph[0].DataColor[sc.Index] i now want to also change the width of the line at the same condition. so .LineWidth = 2; is this possible with ACSIL? i have tried and it changes the entire line. i am assuming because LineWidth doesnt support [sc.Index]. is this assumption correct? if not, what code can i use to change the line width only for the area that the condition is met? thanks alot |
![]() Attachment Deleted. |
[2020-08-25 16:05:10] |
Ackin - Posts: 1865 |
No it doesn't work ... you can have two lines (two subgraphs) that will overlap and one of them will be wide and in places where your area is not there you will assign it zero and turn it off with .Drawzeros = 0
|
[2020-08-25 19:48:39] |
User681150 - Posts: 62 |
im a little confused. would you mind writing the 2 lines of ACSIL that shows the width > 70 and that hides part of the line with .Drawzeros = 0 for anything below 70 ( i assume this is what you are referring to, not 100% sure) thanks alot |
[2020-08-25 22:41:33] |
Ackin - Posts: 1865 |
Simple MA example SCSFExport scsf_MovingAverageSimple(SCStudyInterfaceRef sc) { SCSubgraphRef Subgraph_Avg = sc.Subgraph[0]; SCSubgraphRef Subgraph_Avg2 = sc.Subgraph[1]; SCInputRef Input_Data = sc.Input[0]; SCInputRef Input_Length = sc.Input[1]; SCInputRef Userval = sc.Input[2]; if (sc.SetDefaults) { sc.GraphName = "Moving Average - Simple"; sc.GraphRegion = 1; sc.ValueFormat = 2; sc.AutoLoop = 1; Subgraph_Avg.Name = "Avg"; Subgraph_Avg.DrawStyle = DRAWSTYLE_LINE; Subgraph_Avg.PrimaryColor = RGB(0, 0, 255); Subgraph_Avg.LineWidth = 1; Subgraph_Avg.DrawZeros = true; Subgraph_Avg2.Name = "Avg2"; Subgraph_Avg2.DrawStyle = DRAWSTYLE_LINE_SKIP_ZEROS; Subgraph_Avg2.PrimaryColor = RGB(255, 255, 0); Subgraph_Avg2.LineWidth = 5; Subgraph_Avg2.DrawZeros = 0; Input_Data.Name = "Input Data"; Input_Data.SetInputDataIndex(SC_VOLUME); Input_Length.Name = "Length"; Input_Length.SetInt(5); Input_Length.SetIntLimits(1, MAX_STUDY_LENGTH); Userval.Name = "User Value"; Userval.SetFloat(4500.0f); return; } sc.DataStartIndex = Input_Length.GetInt() - 1; sc.SimpleMovAvg(sc.BaseDataIn[Input_Data.GetInputDataIndex()], Subgraph_Avg, Input_Length.GetInt()); if (Subgraph_Avg[sc.Index] > Userval.GetFloat()) { Subgraph_Avg2[sc.Index] = Subgraph_Avg[sc.Index]; } else { Subgraph_Avg2[sc.Index] = 0; } } |
[2020-08-25 22:42:10] |
Ackin - Posts: 1865 |
+ result image
|
![]() |
[2020-08-26 02:20:06] |
User681150 - Posts: 62 |
thanks Ackin. i feel bad you typed so much just to show how to use it. but i got it and able to implement it. so thanks for the help
|
To post a message in this thread, you need to log in with your Sierra Chart account: