LNRet DataSeries
Author: igorbivor1
Creation Date: 4/7/2014 2:41 PM

igorbivor1

#1
I can't find any documentation or examples of how to build a LNRet DataSeries. LNRet does not support .Series.

Eugene

#2
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.

igorbivor1

#3
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

#4
CODE:

Eugene

#5
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))

Cone

#6
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: