This post is the introduction to a series that will illustrate how to backtest the same strategy in Excel and R. The impetus for this series started with this tweet by Jared Woodard at Condor Options. After Soren Macbeth introduced us, Jared suggested backtesting a simple DVI strategy in Excel and R. The three-post series will show you: Resources that make it easier to move from Excel to R How to test DVI in Excel How to test DVI in R Since I know next to nothing about testing strategies in Excel, I will be writing posts 1 and 3.
Josh Thank you for providing the LSPM package - I… Chris - Apr 2, 2011Josh Thank you for providing the LSPM package - I would not have been able to experiment with using LSPM if I could not use the package. I would like to confirm two things: the maxUnits function has not been built in to the LSPM package - correct? what should one do if using leverage is not an option.
When optimizing leverage space portfolios, I frequently run into the issue of one or more f$ ([Max Loss]/f) being less than the margin of its respective instrument. For example, assume the required margin for an instrument is $500, f$ is $100, and $100,000 in equity. The optimal amount to trade is 1,000 shares ($100,000/$100). However, that would require $500,000 in equity, while you only have $100,000. What do you do?
Josh, If I may comment: The joint probabilities ta… Ralph Vince - May 3, 2010Josh, If I may comment: The joint probabilities table (“jpt”) ultimately should encompass and be a proxy for all potential risk for the next period. In other words, frequently, in attempting to articulate “risk,” we see the argument that it is more than mere variance. That there is liquidity risk, there is counter-party risk, this risk and that risk, and there is a notion that risk posses many facets.
I’ve received several requests for methods to create joint probability tables for use in LSPM’s portfolio optimization functions. Rather than continue to email this example to individuals who ask, I post it here in hopes they find it via a Google search. ;-) I’m certain there are more robust ways to estimate this table, but the code below is a start… ‘x’ is a matrix of market system returns ‘n’ is the number of bins to create for each system
Josh, Thanks for another great explanation. I migh… Ralph Vince - Apr 5, 2010Josh, Thanks for another great explanation. I might point out to that it is not just the optimization algorithms used, but in the case of mazimizing for greatest probability of profit, there are many posssible optimal sets (f1,..,fn,z+,z-). There are multiple sets which will result in an equivalent (and highest) probability of profit. -Ralph Vince If I understand the optimization problem correctly, I think it may be possible to achieve similar results in just minutes of computation with a different optimization approach.
To continue with the LSPM examples, this post shows how to optimize a Leverage Space Portfolio for the maximum probability of profit. The data and example are again taken from The Leverage Space Trading Model by Ralph Vince. These optimizaitons take a very long time. 100 iterations on a 10-core Amazon EC2 cluster took 21 hours. Again, the results will not necessarily match the book because of differences between DEoptim and Ralph’s genetic algorithm and because there are multiple possible paths one can take through leverage space that will achieve similar results.
Hi Joshua! Could you tell me how to calculate prob… senyai - Apr 5, 2010Hi Joshua! Could you tell me how to calculate probability of drawdown using martingale exponents? I do not want to optimize anything, just calculate dd like Vince did at 173 page. My code: -——————————– port <- lsp(trades,probs, f=c(0.085,0.015,0.129), z = c(-0.76, -0.992, 0.0)) probDrawdown(port,0.8,12,13) -——————————– This code shows me value 0.0001982222, but Vince says his dd is 0.
My last post provided examples of how to use the LSPM package. Those who experimented with the code have probably found that constrained optimizations with horizons > 6 have long run-times (when calc.max >= horizon). This post will illustrate how the snow package can increase the speed of the probDrawdown and probRuin functions on computers with multiple cores. This yields nearly linear improvements in run-times relative to the number of cores.
Hi Josh I am trying to replicate the results on p… Chris - Nov 2, 2011Hi Josh I am trying to replicate the results on page 87 (as mentioned in your post above) of the LSPM book. I do the following: > data(port) > DEctrl <- list(NP=30, itermax=100) > res <- optimalf(port, control=DEctrl) The result is : Iteration: 100 bestvalit: -1.293917 bestmemit: 1.000000 0.000000 0.857813 Page 87 reads: MktSysA 0.307