New answers tagged returns
This is the equity line i got after i repeated your code. how is this good ? may be you have run with only one set of numbers. any ways here are a few things you can do to come closer to reality : take the close prices as lognormal distribution instead of a normal distribution. you are adding up the returns later on. this is only right if you have ...
An easy way to perform what you need is do it this way: if your data are daily then : > prices <- data$cl > log_returns <- diff(log(prices), lag=1) would provide you with daily log returns, if you change the $lag=1$ to $lag=5$ then you will get weekly moving log returns.
Top 50 recent answers are included