Support Board
Date/Time: Mon, 24 Feb 2025 06:14:55 +0000
Post From: ACSIL DRAWING_LINEAR_REGRESSION: not updated properly when moved
[2021-02-27 22:01:41] |
ZenAlchemist - Posts: 23 |
When a user drawn linear regression channel's end point is moved via ACSIL, the end point is moved, but the linear regression fit functionality is not updated. Example ascil: if (sc.GetUserDrawnChartDrawing(0, DRAWING_LINEAR_REGRESSION, Tool, -1)) { if (Tool.EndValue < Tool.BeginValue) { // TODO: if tool is pointing lower, then moved end point if price moves lower than end value } else if (Tool.EndValue > Tool.BeginValue) { // if tool is pointing higher, then moved end point if price moves higher than end value int iToolBegin = Tool.BeginIndex; int iToolEnd = Tool.EndIndex; float hi = sc.High[iToolBegin]; int i, indexHigh = iToolBegin + 1; for (i = iToolBegin + 1; i < sc.ArraySize; i++) { if (sc.High[i] > hi) { indexHigh = i; hi = sc.High[i]; } } if (indexHigh > iToolEnd) { Tool.EndIndex = indexHigh; Tool.EndValue = hi; sc.UseTool(Tool); /* DOES NOT WORK Although the regression channel end point is moved, it does not fit the price correctly. it has to be selected and moved manually to get the linear regression functionality to update */ } } } Chart with a user drawn linear regression channel sloping upward: http://www.sierrachart.com/image.php?Image=1614462905652.png Same channel after running above acsil: http://www.sierrachart.com/image.php?Image=1614463177260.png Same channel after manually adjusting to make the linear regression fit work: http://www.sierrachart.com/image.php?Image=1614463220301.png |