Support Board
Date/Time: Sun, 12 Jan 2025 11:42:16 +0000
Post From: What is proper way to modify tool drawings of type DRAWING_LINE?
[2017-02-14 05:36:13] |
Sierra Chart Engineering - Posts: 104368 |
Here is the code example we used for testing: /*==========================================================================*/ SCSFExport scsf_UseToolExampleLine(SCStudyInterfaceRef sc) { // Set configuration variables if (sc.SetDefaults) { sc.GraphName = "UseTool Example: Line"; sc.GraphRegion = 0; sc.FreeDLL = 0; sc.AutoLoop = 0; //No automatic looping return; } int &LineNumber = sc.GetPersistentInt(1); if (sc.IsFullRecalculation) { //Draw vertical line on prior bar during full recalculation. s_UseTool Tool; Tool.Clear(); Tool.ChartNumber = sc.ChartNumber; //Tool.LineNumber will be automatically set. No need to set this. Tool.DrawingType = DRAWING_LINE; int DrawingIndex = sc.ArraySize - 4; Tool.BeginDateTime = sc.BaseDateTimeIn[DrawingIndex]; Tool.EndDateTime = sc.BaseDateTimeIn[DrawingIndex]; Tool.BeginValue = sc.Low[DrawingIndex]; Tool.EndValue = sc.High[DrawingIndex]; Tool.Text = "Label 1"; Tool.TextAlignment = DT_BOTTOM | DT_LEFT; Tool.Region = 0; Tool.Color = RGB(255, 255, 0); Tool.LineWidth = 5; Tool.AddMethod = UTAM_ADD_ALWAYS; sc.UseTool(Tool); LineNumber = Tool.LineNumber; } else if (sc.UpdateStartIndex < sc.ArraySize -1) { //Now move the drawing to the last bar when a new bar has been added to the chart s_UseTool Tool; Tool.Clear(); Tool.ChartNumber = sc.ChartNumber; //Tool.LineNumber will be automatically set. No need to set this. int DrawingIndex = sc.ArraySize - 1; Tool.BeginDateTime = sc.BaseDateTimeIn[DrawingIndex]; Tool.EndDateTime = sc.BaseDateTimeIn[DrawingIndex]; Tool.BeginValue = sc.Low[DrawingIndex]; Tool.EndValue = sc.High[DrawingIndex]; Tool.AddMethod = UTAM_ADD_OR_ADJUST; Tool.LineNumber = LineNumber; sc.UseTool(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: 2017-02-14 05:37:54
|