As title says, I want a code that takes a stock ticker data and finds/draws a linear regression line or draws a trendline connecting the lows (or the highs) Anyone know of or have some of this data developed?

Sierrachart has more than one way to place a linear regression on a chart. I think they have an automatic trendline drawing study too...

I did some web search recently and the easiest to implement come up if you search "regression c++" There are also c# examples if you search for them. There are numerical libraries available for download like Alglib, MathNet Numerics, GSL etc. some with .net or c# implementation. I do not have anything you looking for coded yet. It will get you started with math part. For charting use .net chart control. This control has the ability to display time series, bars etc. with regression and other financial analysis (Financial formulas forecasting). Description how to use it is on MSDN. I use it and it will get you customized charting in your program with little coding. Another option is to draw your own charts as bitmaps and calculating own regression from data.

somebody must have a code for this already done, it is so basic it must have been done 100x already, can anyone help me get the actual c# code? appreciate the help, and thanks to those of you who have offered what you could thus far

I'll also add that I'm looking for the code to kick out the slope of the linear regression line for me, as well as give the correlation, both of these are simple enough, and again if a linear regression line is coded these are the most basic components they would have alongside it, and likely that they would

Can anyone provide me with this code or at least close to it? I know it's common someone must know of where it is

NinjaTrader has both an AutoTrendline indicator and regression channel indicator. The code is opensource. I could post it but that would make it too easy for you

function BestFit(const AnArray: array of Double): Extended; var n: Integer; b,m: Double; begin n := Length(AnArray); b := BestFitB(AnArray); m := BestFitM(AnArray); Result := b + (m * n); end; function BestFitLn(const AnArray: array of Double): Extended; var n: Integer; b,m: Double; begin n := Length(AnArray); b := BestFitB(AnArray); m := BestFitM(AnArray); Result := b + (m * (n+1)); end; function BestFitM(const AnArray: array of Double): Extended; var n,i: Integer; summation,m: Double; begin n := Length(AnArray); summation := 0; for i := 1 to n do summation := summation + (AnArray[i-1] * i); m := ((12/(Power(n,3)-n))*summation) - ((6/(Sqr(n)-n))*Sum(AnArray)); Result := m; end; function BestFitB(const AnArray: array of Double): Extended; var n,i: Integer; summation,b: Double; begin n := Length(AnArray); summation := 0; for i := 1 to n do summation := summation + (AnArray[i-1] * i); b := ((((4*n)+2)/(Sqr(n)-n))*Sum(AnArray)) - ((6/(Sqr(n)-n))*summation); Result := b; end;

If you can link me to them I would be grateful, I don't know if there's multiple versions of it and if any are better than others as I don't currently use ninjatrader