I have buy and sell signals,and accordingly, I artificially generate a signal series,for which,I assign 1 to every buy and -1 to every sell:
library(xts)
require(TTR)
close_series=rnorm(20,100,10)
date=seq(as.Date("2000/1/1"), as.Date("2000/1/20"), "days")
close_xts=xts(close_series,date)
x.points.buy=c(1,5,9,17)
x.points.sell=c(3,6,12,20)
buy.points=index(close_xts[x.points.buy])
sell.points=index(close_xts[x.points.sell])
signal<- xts(rep(NA,length(close_xts)),index(close_xts))
signal[buy.points]<-1
signal[sell.points]<--1
signal<-na.locf(signal)
returns <- ROC(close_xts,type="discrete")*signal
returns[is.na(returns)]<- 0
eq <- exp(cumsum(returns))
This is giving me returns that seem to be too good to be true,I am not able to understand the fundamental methodology on the basis of which these cumulative returns show such huge figures.Can anyone please help me to understand this?