Automated Trading - Code Vba 2
Join the DZone community and get the full member experience.Join For Free
// description of your code here
Private Function Slope(y1 As Double, y2 As Double, y3 As Double) As Double Dim xm_x As Double Dim xm_y As Double Dim xm_xy As Double Dim xm_x2 As Double Dim x1 As Double, x2 As Double, x3 As Double x1 = 1# x2 = 2# x3 = 3# xm_xy = (x1 * y1 + x2 * y2 + x3 * y3) / 3# xm_x = (x1 + x2 + x3) / 3# xm_y = (y1 + y2 + y3) / 3# xm_x2 = (x1 * x1 + x2 * x2 + x3 * x3) / 3# Slope = (xm_xy - xm_x * xm_y) / (xm_x2 - xm_x * xm_x) End Function
Opinions expressed by DZone contributors are their own.