I can't find any documentation or examples of how to build a LNRet DataSeries. LNRet does not support .Series.
Size:
Color:
Hint: Have you tried clicking the blue "More info" link label, implemented by almost all indicators?
And like all indicators out there, LNRet
does support .Series. It's no different than almost any other indicator. There is no code example though because nobody suggested an example of this function's usage.
Size:
Color:
This is still not clear to me. There is no mention of the Series method at the moreinfo link.
Can you give an example of creating a DataSeries with logrithmic returns on closing prices with a period of p?
Thanks
Size:
Color:
CODE:
Please log in to see this code.
Size:
Color:
In a deleted duplicate thread,
sedelstein asked:
The documentation for LNRet is a little confusing
QUOTE:
Parameter Description
bars Bars object
'ds Data series
'period Lookback period
Description
The LNRet by Dr. Rene Koch (originally developed here) is used for comuting logarithms of daily returns.
logarithm of daily returns.
Z(t) := ln(Y(t)) - ln(Y(t - lookback))
or equivalently:
Z(t) := ln(Y(t) / Y(t - lookback))
I think the lookback period is the number of days used in the calculation.
If that the case then
QUOTE:
Z(t) := ln(Y(t)) - ln(Y(t - lookback))
is a little odd since it would imply the ln (Series_Today) - ln (Series_Many days ago) which is not the change in the "Daily" returns which would be
ln(Y(t)) - ln(Y(t-1))
Size:
Color:
Don't get hung up on the word "Daily". The documentation is just showing a logarithmic identity that the difference between the log(x) and log(y) is the same as the log of the quotient of x and y, i.e.,
CODE:
Please log in to see this code.
Size:
Color: