PureBytes Links
Trading Reference Links
|
Lance Fisher wrote:
>I thought... Why not calculate the StdDev using the
>Open, High, Low, & Close rather than just the Close?
I do stuff like that all the time. Or just high, low, and close
(not the open, using the logic that the open is an 'old' price that
would bias the final result).
Another thing to try is an exponential moving standard deviation,
rather than the "standard" arithmetic standard deviation. Code for
the exponential moving standard deviation is
=====================================================================
{_xStdDev Exponential moving standard deviation
by Alex Matulich alex@xxxxxxxxxxxxxx 5/2003
_xStdDev(x,n) returns a good approximation of the standard deviation
of n values of x. In _xStdDev the terms have exponential weight so
the function reacts faster, and recovers from outliers more quickly
than the traditional standard deviation.
}
Inputs:
x(NumericSeries), {price data}
length(NumericSimple); {"lookback" length; can change mid-stream}
Vars:
w0(0), w1(0), {exponential weights}
n(0), {used as sample size}
avx(0); {average of x and average of x^2}
if n <> length or CurrentBar <= 1 then begin {initialize things}
n = length;
w0 = 2/(n+1);
w1 = 1 - w0;
if Currentbar <= 1 then avx = x;
end;
avx = w0*x + w1*avx[1];
_xStdDev = SquareRoot(w0*(x-avx)*(x-avx) + w1*_xStdDev[1]*_xStdDev[1])
=====================================================================
--
,|___ Alex Matulich -- alex@xxxxxxxxxxxxxx
// +__> Director of Research and Development
// \
// __) Unicorn Research Corporation -- http://unicorn.us.com
|