Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 07:04:39 +0000



[User Discussion] - ACSIL DRAWING_LINEAR_REGRESSION: not updated properly when moved

View Count: 459

[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
[2021-03-03 15:11:17]
ZenAlchemist - Posts: 23
bump

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account