title: How is this linear regression calculated?
body: <p>While trying to translate a Pine Script indicator I got stuck at this line that calculates a linear regression with linreg().  Isn't a linear regression formula supposed to take in an array?</p>
  
  <p><code>val = linreg(source - avg(avg(highest(high, lengthKC), lowest(low, lengthKC)),sma(close,lengthKC)), 20,0)</code></p>
  
  <p>I want to use the trader_linearreg() function from the trader_php extension, but it takes in an array as the first argument.</p>