I want to code my stratgies for back-testing using linear indicator

I want to buy the stock above the " Linear Regression Intercept (5)"And as well sell below the "Linear Regression Intercept (5)" Sir plz code my strategies ..
 

As per the above condition 

BuyScript:

Intercept(CLOSE, 5) < REF(CLOSE,1)

SellScript:

Intercept(CLOSE, 5) > REF(CLOSE,1)