And as an object, trendlines have 2 points, start point and end point. Let's call them 1 and 2. Each of them has Time and Price coordinate. So point 1 is located at T1,P1 and point 2 is located at T2,P2.
Horizontal lines are infinite, they have only 1 coordinate - the price level. Vertical lines have only time coordinate because they are infinite vertically.
In short, to draw a trendline you have to calculate 4 values. Let's say that EAs are not born to do this thing, but there are some indicators like this one: http://www.truetl.com/true-trendline-indicator.html