Support Board
Date/Time: Sun, 29 Dec 2024 00:24:51 +0000
Post From: ACSIL Tool drawing; DRAWING_LINE extendright and extendleft
[2016-02-16 02:01:44] |
@sstfrederik - Posts: 404 |
Hi, I want to plot a line with sc.UseTool and extend it to the right. I found out that this can be done only when there is a second call to the sc.UseTool function. The first call will not have extended lines the second call does. The code below will demonstrate that. Ideally I would like to call sc.Usetool as less often a possible. Is it on purpose that a first call will not draw the extended line? I will be happy to use it as is, but was curious if it can be optimized. Thanks Frederik SCSFExport scsf_Debug(SCStudyInterfaceRef sc)
{ SCInputRef ExtendRight = sc.Input[0]; SCInputRef Counter = sc.Input[1]; if (sc.SetDefaults) { // Set the configuration and defaults sc.GraphName = "debug"; sc.GraphRegion = 0; sc.StudyDescription = "we debug and test"; sc.AutoLoop = 0; // During development set this flag to 1, so the DLL can be modified. When development is done, set it to 0 to improve performance. sc.FreeDLL = 1; ExtendRight.Name = "Extend lines to the right"; ExtendRight.SetYesNo(1); ExtendRight.SetDescription("extend to right"); Counter.Name = "counter"; Counter.SetInt(1); Counter.SetDescription("counter"); return; } if(sc.UpdateStartIndex == 0){ int& counter = sc.PersistVars->i1; counter = 0; } //main loop with manual looping for (int index = sc.UpdateStartIndex; index < sc.ArraySize; index++ ){ int& counter = sc.PersistVars->i1; if(sc.UpdateStartIndex != 0 && counter < Counter.GetInt()){ int& counter = sc.PersistVars->i1; s_UseTool Tool; Tool.Clear(); // reset tool structure for our next use Tool.ChartNumber = sc.ChartNumber; Tool.DrawingType = DRAWING_LINE; Tool.ExtendRight= ExtendRight.GetYesNo(); Tool.ExtendLeft = 1; Tool.LineNumber = 123451; Tool.BeginDateTime = sc.BaseDateTimeIn[sc.ArraySize - 40]; Tool.EndDateTime = sc.BaseDateTimeIn[sc.ArraySize + 1]; Tool.BeginValue = sc.High[sc.Index]; Tool.EndValue = sc.High[sc.Index]; Tool.Color = RGB(0, 0, 255); sc.UseTool(Tool); counter +=1; SCString MessageString; MessageString.Format("counter = %d", counter); sc.AddMessageToLog(MessageString,1); } } } |