Skip to content

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

@clairdelaluna

Description

@clairdelaluna

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions