No idea for specifically what is there in MS 10.1 but the formula below would work in it :
***********************************************
MetaStock -> Tools -> Indicator Builder -> New
Copy and paste formula below.
======================
LinReg Indicator/Slope
======================
---8<---------------------------
{ Linear Regression Indicator/Slope MS formula }
{ Precision accumulation errors courtesy of
MetaStock's Cum() single-precision function }
{ ©Copyright 2003-2004 Jose Silva }
{ For private use only }
{ User inputs }
pds:=Input("Linear Regression periods",
2,2520,21);
plot:=Input("Linear Regression: [1]Indicator, [2]Slope",1,2,1);
x:=Input("[1]Open, [2]High, [3]Low, [4]Close, [5]WgtCl, [6]P",1,6,4);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,WC(),If(x=6,P,C)))));
{ Lin Reg Slope }
counter:=Cum(1)-pds;
y:=pds*Sum(counter*x,pds)
-Sum(counter,pds)*Sum(x,pds);
z:=pds*Sum(Pwr(counter,2),pds)
-Pwr(Sum(counter,pds),2);
z:=
LastValue(ValueWhen(1,Cum(IsDefined(z))=1,z));
LRS:=y/z;
{ Lin Reg Indicator - LR trendline end point }
LRI:=LRS*pds-LRS*(pds+1)/2+Mov(x,pds,S);
{ Lin Reg trendline start point }
LRstart:=Ref(LRI-LRS*(pds-1),pds-1);
{ Plot }
If(plot=1,LRI,LRS)
---8<---------------------------