braverock / braverock/quantstrat

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

Open
#144 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
310
Forks
121
PR merge metrics
No merged PRs in 30d

Description

### 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:
```r

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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.