[R-SIG-Finance] R-SIG-Finance Digest, Vol 138, Issue 8

Adrian Trapletti adrian at trapletti.org
Wed Nov 25 13:23:30 CET 2015


Using simulation

p <- 100
sd <- 0.2
X <- 90
N <- 10
n <- 1000000
hit <- double(n)
for (i in 1:n) {
  hit[i] <- as.numeric(any(p * exp(cumsum(
    rnorm(N, sd = sd / sqrt(250))
  )) < X))
}
sum(hit)/n

Instead of using rnorm you may want to use e.g. rt() or an (G)ARCH
process or...

Best Adrian

On 25.11.2015 12:00, r-sig-finance-request at r-project.org wrote:
> Message: 1
> Date: Tue, 24 Nov 2015 18:27:19 -0600
> From: Ernest Stokely <wizardchef at gmail.com>
> To: R-SIG-Finance at r-project.org
> Subject: [R-SIG-Finance] Computing stop probability
> Message-ID: <CA1CB4F2-72E7-45B6-A124-A12BDAB33CE0 at gmail.com>
> Content-Type: text/plain;	charset=us-ascii
>
> Maybe a naive question but given the price and SD of an asset, is there a way to calculate the probability of hitting a stop set at X over the next N days? I know making appropriate assumptions, this is a Wiener process but can't find the correct equation.
>
> A) Is there a closed form solution for this?
> B) Is there an R function related to this?
>
> Ernie
>
> Sent from my iPhone

-- 
Dr. Adrian Trapletti
Steinstrasse 9b
CH-8610 Uster
Switzerland

Phone : +41 (0) 44 994 56 30
Mobile : +41 (0) 79 103 71 31

Email : adrian at trapletti.org
WWW : www.trapletti.org



More information about the R-SIG-Finance mailing list