Announcement

Collapse
No announcement yet.

linear regression angle slope

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

  • linear regression angle slope

    i need an efs that shows the slope or angle of the linear regression line starting at 9:30 and ending at 4:00.
    For instance if the linear regression line goes up from 9:30 on the angle of the line would be positive or up. If the linear regression line goes down starting at 9:30, the angle or slope would be negative or down.
    Could someone help me with this efs?

  • #2
    ? angle = Math.atan2(deltaTime, delatPrice)
    where, if you know the index of the candles for 4:30 and 9:30 (say nA and nB),
    deltaPrice = StudyCreatedFrom_middleLinearReg.getValue(nB) - StudyCreatedFrom_middleLinearReg.getValue(n)
    and
    deltaTime = rawtime(nB) - rawTime(nB)
    The "angle" will not be a real "paper" angle but is based on the rawTime "scaling", and is probably in radians anyway.
    Anyway, that's my guess.

    Comment


    • #3
      Has anyone figured out how to calculate the angle (in degrees) between two points? This would be a very helpful study and none of the discussions I've found so far work. Aside from that, none of them deal with the issue of adjusting the results based on quadrants. There has been some discussion, but I can't seem to find anything.

      I wrote the attached from this post, but it doesn't seem to work either.

      Any thoughts? Thanks.
      Attached Files

      Comment


      • #4
        Hi AssetHound,

        Alex has an efs in this folder entitled 'amLinRegAngle.efs' that uses his amFunctions function library. Perhaps that will work for you.

        Comment


        • #5
          I saw this but I'm having trouble understanding what it actually returns. In what looks like a -45 degree angle to me, the results from this study were -0.86 which looks incorrect. I'm not sure what this number is and I didn't see any documentation.

          Originally posted by stevehare2003
          Hi AssetHound,

          Alex has an efs in this folder entitled 'amLinRegAngle.efs' that uses his amFunctions function library. Perhaps that will work for you.

          Comment


          • #6
            AssetHound
            The function replicates TradeStation's LinearRegAngle function. The definition is as follows
            "This function is very similar to the LinearRegSlope function, except it returns the angle of that line in terms of degrees. In fact, to obtain the LinearRegAngle one could take the ArcTangent of the LinearRegSlope function."
            Alex


            Originally posted by AssetHound
            I saw this but I'm having trouble understanding what it actually returns. In what looks like a -45 degree angle to me, the results from this study were -0.86 which looks incorrect. I'm not sure what this number is and I didn't see any documentation.

            Comment


            • #7
              I ran the linear regression angle study but the resulting numbers don't look like the correct angle. However, if you take the arctangent of them, they do appear correct. I am running the angle study and not the slope study.

              I'll keep working on this. Thanks.

              Originally posted by Alexis C. Montenegro
              AssetHound
              The function replicates TradeStation's LinearRegAngle function. The definition is as follows
              "This function is very similar to the LinearRegSlope function, except it returns the angle of that line in terms of degrees. In fact, to obtain the LinearRegAngle one could take the ArcTangent of the LinearRegSlope function."
              Alex

              Comment

              Working...
              X