Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Continuously compounded returns

Hi, i am new to qlikview and i'd like to make an application that has an input some tables from yahoo finance and then calculates the cc returns and other things that needs them in the formula, but i have some problems with cc returns.

In the input file i only need the field [Adj Close], and they're in decreasing order of date (the first date is related to december 2014). I tried with

log(Above(Avg([Adj Close])))-log(Avg([Adj Close]))

but the result is a bit different from the plot i obtain in R

(r code is

diff(log(funds.z))

and diff is the lagged difference with interval 1, that should be the same as the above function).

Can anyone help me with the cc returns formula? Thanks in advance

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Dear Fabio,

I use an extraction of your data to perform this formula diff(log(Media)) in R.

Media is the mean of all values in a year, so I had 45 values for Media.

Results are ugual to those you have in QV (with the option in tab Number fixed to 5 or more decimals), but opposite: are you sure the correct expression is log(Above(Avg([Adj Close])))-log(Avg([Adj Close]))?

If I change minus with plus, -log(Above(Avg([Adj Close])))+log(Avg([Adj Close])), I obtain the same results as is R.

Let me know!

Elena

View solution in original post

6 Replies
ecolomer
Master II
Master II

Hi, Can you uoload an example or a file qv, please?

Not applicable
Author

This is what i've done

ecolomer
Master II
Master II

I do not know if I can help you, because not quite understand the problem and what you want to solve

Not applicable
Author

Oh, i forgot the data, maybe it can help (extract the archive and put the folder Data in the same of qvw file)

Anonymous
Not applicable
Author

Dear Fabio,

I use an extraction of your data to perform this formula diff(log(Media)) in R.

Media is the mean of all values in a year, so I had 45 values for Media.

Results are ugual to those you have in QV (with the option in tab Number fixed to 5 or more decimals), but opposite: are you sure the correct expression is log(Above(Avg([Adj Close])))-log(Avg([Adj Close]))?

If I change minus with plus, -log(Above(Avg([Adj Close])))+log(Avg([Adj Close])), I obtain the same results as is R.

Let me know!

Elena

Not applicable
Author

solutions to most of problems are little things, thanks