Announcement

Collapse
No announcement yet.

Need to update linear regression after each 3 minute bar

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

  • Need to update linear regression after each 3 minute bar

    Need code to update linear regression calculation after each 3 minute bar.

    See efs below
    Attached Files
    Larry Dudash
    HAL at
    http://share.esignal.com/groupconten...r=&groupid=549

  • #2
    larrydudash
    The easiest way to resolve the update of the Linear Regression line is to draw it using drawLineRelative rather than plotting the value. Insert the following line of code just above the return statement
    PHP Code:
    drawLineRelative(-Length+1xMidLR.getValue(-Length+1) , 0xMidLR.getValue(0), PS_SOLID1Color.red"Mid"); 
    Then replace getSeries(xMidLR) in the return statement with formatPriceNumber(xMidLR.getValue(0)) which will display the values in the Cursor Window without plotting them on the chart.
    Alex


    Originally posted by larrydudash
    Need code to update linear regression calculation after each 3 minute bar.

    See efs below

    Comment


    • #3
      Alexis
      Question?
      (1) So far it appears the last half of the reg line is changing.
      (2) Did you do that on purpose?
      (3) Does "Mid" do this ????


      PS: Thanks for the code.
      It is changing with each bar.
      Larry Dudash
      HAL at
      http://share.esignal.com/groupconten...r=&groupid=549

      Comment


      • #4
        Larry
        You are most welcome.
        1-2) No that is just an artifact of how the line gets redrawn by the formula engine.
        3) "Mid" is just a tag name that I already had in my revised version of the Linear Regression study from which I copied that command.
        Alex

        Comment


        • #5
          Alex
          Thanks again.
          Now every thing is clear.
          Larry Dudash
          HAL at
          http://share.esignal.com/groupconten...r=&groupid=549

          Comment


          • #6
            Larry
            As always my pleasure
            Alex

            Comment

            Working...
            X