Announcement

Collapse
No announcement yet.

Standard Deviation of range

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Standard Deviation of range

    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
    PHP Code:
    var aSource getValue(sPriceSource0, -nLength); 
    I guess it doesnt like the way I call the range as sPriceSource... Is this an easy fix??

    PHP Code:
    function main(nLengthsPriceSource) {
    var 
    vRange high() - low();
    if (
    nLength == nullnLength 100;
    if (
    sPriceSource == nullsPriceSource vRange;

    var 
    aSource getValue(sPriceSource0, -nLength);
    if (
    aSource == null) return null;

    var 
    sumX 0;
    var 
    sumX2 0;
    for (
    0nLength; ++i) {
    sumX += aSource[i];
    sumX2 += (aSource[i] * aSource[i])
    }
    var 
    meanX = (sumX/nLength);
    var 
    stdev Math.sqrt((sumX2/nLength) - (meanX*meanX)); 

    Thanks
Working...
X