[Returnanalytics-commits] r2536 - pkg/PerformanceAnalytics/sandbox/pulkit/week3/code
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jul 10 16:05:20 CEST 2013
Author: pulkit
Date: 2013-07-10 16:05:20 +0200 (Wed, 10 Jul 2013)
New Revision: 2536
Added:
pkg/PerformanceAnalytics/sandbox/pulkit/week3/code/MonteSimulTriplePenance.R
Log:
Monte Carlo Simulation for Triple Penance Rule
Added: pkg/PerformanceAnalytics/sandbox/pulkit/week3/code/MonteSimulTriplePenance.R
===================================================================
--- pkg/PerformanceAnalytics/sandbox/pulkit/week3/code/MonteSimulTriplePenance.R (rev 0)
+++ pkg/PerformanceAnalytics/sandbox/pulkit/week3/code/MonteSimulTriplePenance.R 2013-07-10 14:05:20 UTC (rev 2536)
@@ -0,0 +1,34 @@
+#' @title
+#' Monte Carlo Simulation for the Triple Penance Rule
+#'
+#' @param R Hedge Fund log Returns
+#'
+#' @reference Bailey, David H. and Lopez de Prado, Marcos, Drawdown-Based Stop-Outs and the ‘Triple Penance’ Rule(January 1, 2013).
+
+
+
+monte_simul<-function(size){
+
+ phi = 0.5
+ mu = 1
+ sigma = 2
+ dp0 = 1
+ bets = 25
+ confidence = 0.95
+
+ q_value = getQ(bets, phi, mu, sigma, dp0, confidence)
+ ms = NULL
+
+ for(i in 1:size){
+ ms[i] = sum((1-phi)*mu + rnorm(bets)*sigma + delta*phi)
+ }
+ q_ms = quantile(ms,(1-confidence)*100)
+ diff = q_value - q_ms
+
+ print(q_value)
+ print(q_ms)
+ print(q_value - q_ms)
+}
+
+
+
More information about the Returnanalytics-commits
mailing list