It is a trend line. It is made by drawing a line through three local maxima or minima that happen to lie on a line where most data is below/above the line, respectively. There doesn't seem to be an elegant formula used for finding them.
A randomized approach could be: You could find all the local maxima in your window and repeatedly select three points, testing to see how well a line fits them and how often the prices go above the line, and pick the best one.
A deterministic approach could be: Find the convex hull of your data. Each segment on the hull can be extended in either direction to be a trend line that touches at least two points. Additionally, all points are guaranteed to lie on one side of each of these lines. Choose the line that touches the most points (you can keep track of how many data points each line touches while you're running the convex hull algorithm). Graham scan or the gift-wrapping algorithm will work. You do run into the problem of having to choose your window, but you can solve this buy running the algorithm for multiple window offsets and selecting the best from all of them.
There can be multiple possible trend lines per window, and it is scale-dependent. The blue line in that picture is also a trend line.