Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signals.R -- post.signal.returns function returns only difference in levels, not returns #144

Open
clairdelaluna opened this issue Sep 14, 2021 · 3 comments · May be fixed by #145
Open

Comments

@clairdelaluna
Copy link

Description

As in title -- when using the apply.paramset.signal.analysis function, which calls on the post.signal.returns function, we're seeing the changes in the level, rather than returns.

Expected behavior

Be able to switch to analysing the behaviour post-signal in returns space.

Minimal, reproducible example

add a parameter called cum.return (default false so the function retains previous behaviour), but if true hits the following code block:

for(j in 1:length(idx)){
      signal.ret[j,] = tryCatch({
      na.omit(diff( log(getPrice(mktdata[idx[j] + (days.increment * days.in.period)  ,])) ))
    }, error = function(e){
      cat('')
      stop('Not enough forward data to evaluate post signal returns.')
    })}
    signal.ret=t(apply(signal.ret+1,1,cumprod))-1
@braverock
Copy link
Owner

thanks for the suggestion

at first glance, this looks doable. We'll review.

@clairdelaluna
Copy link
Author

I've made the changes myself on my local version, so happy to open a PR on the matter.

@braverock
Copy link
Owner

yes, please open a PR tied to this issue. It will make it easier to review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants