The following formula plots the Linear Regression. I have created the start and ending points for the linearray as well as the starting and ending y values. When I press the "apply indicator" the line array appears for a moment and then disappears. Any help in identifying my coding error is appreciated.
Thanks, David K. //Linear Regression Line Array GraphXSpace=5; Plot(C,"",29,128|4); pds=20; lbk=0; bi = BarIndex()+1; sb = SelectedValue(BarIndex()); sx = SelectedValue(bi)-lbk; aa = SelectedValue(Ref(LinRegIntercept(C,pds),-lbk)); bb = SelectedValue(Ref(LinRegSlope(C,pds),-lbk)); yy = aa + bb * (bi-(sx - pds+1)); xs = sb - pds - lbk;//Linearray starting point ys = SelectedValue(Ref(yy, -pds-lbk));//Linearray starting value xe = sb - lbk;//Linearray ending point ye = ys + bb *(xe - xs);//Linearray starting value LR = IIf(bi >= (sx - pds) AND bi <= sx, yy, Null);//standard LR line Plot(LR, "LR", 10, 1);//plot Linear Regression Line Plot(IIf(bi>xs,ys,Null),"",36,8);//Linearray starting Value from "xs" Plot(IIf(bi>xe,ye,Null),"",36,8);//Linearray ending Value from "xe" Plot(LineArray(xs,ys,xe,ye,1),"LR",25,1);//This line only plots for a moment when "apply indicator" is pressed and then disappears
