Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
27

The way you do it in the first place is a discretization of the Geometric Brownian Motion (GBM) process. This method is most useful when you want to compute the path between $S_0$ and $S_t$, i.e. you want to know all the intermediary points $S_i$ for $0 \leq i \leq t$. The second equation is a closed form solution for the GBM given $S_0$. A simple ...


24

Monte Carlo is most useful when you lack analytic tractability or when you have a highly multidimensional problem. For example, even using simple lognormal and poisson models, there exist path-dependent payoffs or multi-asset computations such that no analytic solution exists and such that any PDE finite difference solution would require 3 or more ...


11

To complement @SRKX comment ,i'll try to explain the "simple mathematical proof" beetween both formula : I assume you know the geometric or arithmetic brownian motion : Geometric: \begin{equation*} dS = \mu S dt + \sigma Sdz \end{equation*} Arithmetic : \begin{equation*} dS = \mu dt + \sigma dz \end{equation*} Then another important stochastic tool you ...


9

Two ways: Model the returns using an Ornstein-Uhlenbeck process You can control the variance of the residual noise in the process to your desired level of correlation. Conceptually you inject gaussian noise into the synthetic OU process to satisfy your requirement. For example, let's say you have time-series A which is what you are modelling. Time-series ...


9

We cannot give you a relative bid-ask spread that would make sense. The reason for that is that it really depends on several parameters: The type of financial asset you invest in (futures, funds, index, options, ...) The period during which you're trading (I think the liquidity in markets hasn't been the same over time). If you trade intraday, it depends on ...


9

Your formula looks like cointegration (between the price time series) rather than correlation (between the returns). To simulate "correlated random walks", i.e., random walks built from correlated innovations, you can just build the desired covariance matrix (for instance, put ones on the diagonal and $\rho$ everywhere else), take multivariate gaussian ...


9

I think to understand the martingale/local martingale distinction, it helps to bring in a third class of processes, the uniformly integrable martingale. I would argue that the local martingale and the non-uniformly integrable (true) martingale are actually fairly similar. The key property that a uniformly integrable martingale has is the so-called closure ...


8

"Treshold Garch" or T-Garch models are designed to capture this asymmetry. See this exposition by U. Chicago's Ruey Tsay who has a terrific text on time-series models in "Analysis of Financial Time Series". You can use the structure of the T-Garch models to simulate data with this property. There is a package called fGarch that creates APARCH models. A T-...


8

It depends on the purpose of your simulation. If you want to model the asset price path for pricing some derivative then you need the risk-neutral measure (thus you take the risk-less rate as drift). Why? Because the risk-neutral measure makes your pricing compatible with the pricing of other contracts in the market. It makes the prices consistent. If ...


7

These patterns are of course well-known enough to have been "priced in" to the financial markets. Jump diffusions are a classic way to capture the phenomenon, and often have closed-form option pricing formulas associated with them. The implied option skew, for example, gets a lot flatter when you use a JD model. Jump diffusions are often combined with ...


7

The term "Walk Forward Analysis" typically comes from technical analysis schemes. If that's the case here, I would be careful with whatever you're considering (or reading). Even if you tune your model parameters (and I'm not talking about any TA scheme) with 80% of the data and then "check" your model with the remaining 20%, you're still using that last ...


7

If your variable of integration is truly one-dimensional, as you seem to be saying, then you should be using quadrature to evaluate the expectation integral. The computational efficiency of quadrature is much higher than Monte Carlo in one dimension (even accounting for modified sampling). If your problem is actually multidimensional, your best bet is to ...


7

By definition, the payoff of a log-contract of maturity $T$ writes $$ \phi(S_T) = \ln\left(\frac{S_T}{S_0}\right) $$ Let $\Pi_t$ denote the $t$-value of such a contingent claim. We are interested in the price at $t=0$, best known as the option premium. Theory tells us that the latter premium can be computed as $$ \Pi_0 = e^{-rT} E^{\mathbb{Q}} \left[ \phi(...


7

Yes, the term Brownian Bridge seems to be used loosely. I assume you are talking about continuously monitored barriers by the way, since you mention the probability of the barrier being crossed in between the path time points. If that's the case then "naive" Monte Carlo simulation will have what is called "simulation bias". That's exactly because the ...


6

Yes, there is in fact a whole literature on this subject coming from the field of non-linear dynamics-- it is known as the method of surrogates. The idea is essentially to come up with a "scrambled" version of your original data set that preserves many of the basic statistical properties, though perhaps not the serial dependence structure which might be ...


6

In general these are the two basic approaches to QuantFinance: Sell side (market maker, risk neutral): You use risk-neutral probabilities ("$\mathbb{Q}$") e.g. in option pricing (to e.g. calculate your greeks and hedge your portfolio), so that you live on the spread. Buy side (market/risk taker): You use real-world probabilites ("$\mathbb{P}$") for e.g. ...


5

Consider a $T \times N$ matrix of potentially cointegrating prices $P$. Define $Y_{t}\equiv ln\left(P_{t}\right)$. In the multivariate framework, there are two basic methods to estimate the cointegrating relationships. The first is an error correction framework of the form $$\Delta Y_{t} = \beta_{0}+\beta_{1}\Delta Y_{t-1}+\beta_{2}Y_{t-1}+\varepsilon_{t}$$ ...


5

The very easiest change you can make is to switch to quasirandom sampling. I favor the Niederreiter sequence, for which you can find implementations in most languages around the web. You can also get a (sometimes tremendous) speed boost by running using a control variate. Even a swap would probably reduce your variance somewhat. I don't recall the CIR ...


5

Since both $ER$ and $S$ are gaussian random, why not just assume their dependence is captured by their covariance, and make your draws from the bivariate normal distribution? It is hard to construct any other way of making two marginal gaussians cointegrated. Even if the variables were not gaussian, you would probably find yourself relating them using a ...


5

Normally, one uses MC methods when: Analytical solutions do not exist PDE style solutions also don't work (they are usually still faster than MC) You need to price some exotic, but computation time does not matter (MC methods are easy(-ier) and fast to code-up) Note: Using MC is not free of assumptions: you always assume a distribution for the driving ...


5

For completeness, let's restate that the discrete case goes like this: $$\Delta S_t = S_{t+\Delta t}- S_t = \mu S_t \Delta t + \sigma S_t \sqrt{\Delta t} Z_t $$ with $Z_t \sim \mathcal{N}(0,1)$ What you are doing in your case is to use the exact solution of the SDE to model the movement between two points of $S$. Essentially, you are doing the same thing ...


5

When I run this simulation I see the same results, and it makes sense. For the straight 50%/50%, I found that my win ration was about 38% and my loss ratio 61%. The reason it wasn't 50/50 was that if I had consecutive up flips my value could keep going up, but if I had consecutive down flips I would 0 out and the sequence would have to end as I had lost ...


5

This approach is rather crude. It only takes the mean and volatility of the historical returns and assumes a very simple model. I'm not sure if you have much experience with Time Series, but your returns series is a Time series. You can now perform tests on these log returns to ensure you can continue with Time series models. One very simple model is ARMA. ...


5

Is there a place online where you can simulate strategies programmatically? Your best choice is most likely a service such as Quantopian or QuantConnect. Quantopian provides equity and futures data and allows you to program trading strategies in Python, run risk management analysis and backtests. The latter option, QuantConnect, has support for Python as ...


4

Wilmott Forums - "How can I simulate correlated random numbers?" Generating correlated normal variates Random Correlated Series Generator (using R) All found with a Google search for "how to generate random correlated series".


4

I have a few thoughts, but no real answers :). You take the returns from the DAX, which isn't normal, then make it normal and apply normal noise to it. It seems that you could be slightly better off just applying the noise to the original, non-normalized DAX. Have you considered the t-distribution? There are multivariate t-distribution packages in R (e.g., ...


4

I found a very good process for running a walk forward analysis in The Encyclopedia of Technical Market Indicators, Second Edition: http://www.amazon.com/Encyclopedia-Technical-Market-Indicators-Second/dp/0070120579 . The approach in the book helps mitigate the problem described above of assemble/test/retest. When you finally implement a trading system, it ...


4

One way to construct cointegrated timeseries it to use the error-correction representation (see Engle, Granger 1987 for details of the equivalence). To generate two timeseries that are cointegrated, start with your cointegrating vector $(\alpha_1, \alpha_2)$ so that you want $\alpha_1x_t + \alpha_2y_t$ to be stationary; choose initial values $x_0, y_0$ and ...


4

The common practices are: if you trade less than 8% of the Average Daily Volume, you can use a VWAP or Implementation Shortfall algo. you need to "add" a slippage of 1/3 of the bid ask spread of the stock. Your only issue is that you want to use the close price instead of the VWAP one. Best option is to use the daily VWAP as a proxy. Otherwise measure the ...


Only top voted, non community-wiki answers of a minimum length are eligible