Because if trendline is diagonal, the order price must be constantly modified to go along with the line. So if order price is needed to be constantly modified, it's the job of Expert Advisor not script, because script, like you said, run only one-time when you double click on it.
By the time I described to you, I've coded the expert advisor for you already, so check it out in Forward Testing not Backtesting. You must draw a trendline and name it tx (case sensitive). Attach the expert to the same chart that trendline is drawn. Then you can choose to open only Long, Short, Both, or none in the settings window. When bid price crosses up the trendline, buy at market price. When bid price crosses down the trendline, sell at market price.
Enjoys!