Trying a few different things with the high/low range. Currently trying to get the Standard Deviation of it.
Ive tried the following code,but getting an error
on line
I guess it doesnt like the way I call the range as sPriceSource... Is this an easy fix??
Thanks
Ive tried the following code,but getting an error
on line
PHP Code:
var aSource = getValue(sPriceSource, 0, -nLength);
PHP Code:
function main(nLength, sPriceSource) {
var vRange = high() - low();
if (nLength == null) nLength = 100;
if (sPriceSource == null) sPriceSource = vRange;
var aSource = getValue(sPriceSource, 0, -nLength);
if (aSource == null) return null;
var sumX = 0;
var sumX2 = 0;
for (i = 0; i < nLength; ++i) {
sumX += aSource[i];
sumX2 += (aSource[i] * aSource[i])
}
var meanX = (sumX/nLength);
var stdev = Math.sqrt((sumX2/nLength) - (meanX*meanX));
Thanks