for line formula y=mx+b slope is m=y2-y1/x2-x1 between points (x1,y1) and (x2,y2) where x would be either index or time (probably transformed to integer or some other value that is more math friendly) and y is price or indicator value (if x2-x1 = 0 then you get overflow error because of division...