PureBytes Links
Trading Reference Links
|
> However, if I want to use the same function to find the Volatility
> of a variable I can't work out the syntax. For example, the
> following doesn't work.
>
> Volatility(Length) of value1; {where value 1 is the Sumlist of data2-10}
"(something) of (data series)" only works when (data series) is a
data series like Data2 or Data(N). You can't use a variable there.
Look at the source for the Volatility function:
inputs : Length(NumericSimple);
if CurrentBar >= 1 and Length <> 0
then begin
if CurrentBar = 1 then
Volatility = TrueRange
else
Volatility = ((Length - 1) * Volatility[1] + TrueRange) / Length;
end;
It's calculating the volatility using the TrueRange of the specified
data series. If you want to calculate the volatility of a variable,
you'll have to use your own Volatility function and calculate the
TrueRange of your variable.
Gary
|