Announcement

Collapse
No announcement yet.

using LinearReg function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • using LinearReg function

    My goal is to chart a line consisting of the last points for each bar of the LinearRegression() function. This can be done using, for example, the ema() function.

    LinearRegression() function behaves differenly. Examples:
    middleLinearReg(20,1) returns a line of 20 poits ending with bar 0
    middleLinearReg(20,1,0) returns nothing
    middleLinearReg(20,1,-15) returns a line of 20-15=5 points ending with bar 0
    middleLinearReg(20,1,-19) returns a single point for bar 0
    middleLinearReg(20,1,10) returns a line of 20 points ending with bar -10.

    How can I construct a stetement that will achieve my goal?
    contrary to what the functional reference says about this function, the function does not return a single value for a bar specified in the nBarIndex parameter.

    Thank you
    dtrosty

  • #2
    But the example code posted above that is correct so use that. In this example you would use the myStudy2 series variable and pull single values from it with the .getValue() function.

    Comment

    Working...
    X