automated trading - code vba 2


/ Published in: Visual Basic
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Private Function Slope(y1 As Double, y2 As Double, y3 As Double) As Double
  2. Dim xm_x As Double
  3. Dim xm_y As Double
  4. Dim xm_xy As Double
  5. Dim xm_x2 As Double
  6.  
  7. Dim x1 As Double, x2 As Double, x3 As Double
  8. x1 = 1#
  9. x2 = 2#
  10. x3 = 3#
  11.  
  12. xm_xy = (x1 * y1 + x2 * y2 + x3 * y3) / 3#
  13. xm_x = (x1 + x2 + x3) / 3#
  14. xm_y = (y1 + y2 + y3) / 3#
  15. xm_x2 = (x1 * x1 + x2 * x2 + x3 * x3) / 3#
  16.  
  17. Slope = (xm_xy - xm_x * xm_y) / (xm_x2 - xm_x * xm_x)
  18. End Function

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.