Closed form of Weighted Ordinary Least Squares calculation of the trend line
We found the answer:

The formula is really close to the original OLS closed formulation:

$\beta = \frac{n\sum{(wx)(wy)}-\sum{xw}\sum{wy}}{n\sum{(wx)^2}-(\sum{wx})^2}$

There is something that should be warned:
When the sample is small, the method will simply don't work at all, resulting in absurd estimations of the $\beta$.

Make sure your sample is big enough!