Login Page - Create Account

Support Board


Date/Time: Tue, 14 May 2024 01:44:58 +0000



Post From: Linear Regression Discrepancies

[2019-04-26 22:57:40]
maxpi - Posts: 175
A linear regression channel tool drawing and the ACSIL drawing for same do not match. The Tool channel matches that produced by the Linear Regression End Channel study. The channel drawn by ACSIL is the outlier of the three methods. The following study draws a 10 bar channel using ACSIL. Install this along with the Linear Regression End Channel study with it's default settings to see the differences.

#include "sierrachart.h"

SCDLLName("Custom Study DLL")

SCSFExport scsf_drawingTool86(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    sc.GraphName = "Linear regression drawing from acsil";

    sc.AutoLoop = 1; //Automatic looping is enabled.
    
    
    
    return;
  }
  
  
  int beginIndex =sc.ArraySize -10;
  int endIndex =sc.ArraySize -1;
  
  s_UseTool  LinReg;
  
  LinReg.ChartNumber = 0;
  LinReg.DrawingType = DRAWING_LINEAR_REGRESSION;
  LinReg.LineNumber = 1;
  LinReg.BeginIndex = beginIndex;
  LinReg.BeginValue = sc.Close[beginIndex];
  LinReg.EndIndex = endIndex;
  LinReg.EndValue = sc.Close[endIndex];
  LinReg.Color = RGB(0, 128, 0);
  LinReg.LineWidth = 3;
  LinReg.AddMethod = UTAM_ADD_OR_ADJUST;
  LinReg.RetracementLevels[0] = 2.0f;
  LinReg.RetracementLevels[1] = -2.0f;
  LinReg.AddAsUserDrawnDrawing =1;
  LinReg.LevelColor[0] = COLOR_YELLOW;
  LinReg.LevelColor[1] = COLOR_YELLOW;
  LinReg.ExtendRight = 0;

  sc.UseTool(LinReg);
  
  
}