Tag Info

Hot answers tagged

18

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 ...


12

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 ...


8

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 ...


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 ...


8

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 ...


7

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 ...


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 ...


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 ...


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

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 ...


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

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

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 \sqrt{\Delta t} Z_t $$ with $Z_t \sim \mathcal{N}(0,1)$. What you are doing in your case (although there is a typo in your formula) is to use the exact solution of the SDE to model the move between two points of $S$. ...


5

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 ...


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 ...


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 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

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 ...


4

When I simulate, I can usually narrow my trades down to the minute. So I set my Open price at the HIGHEST price for the minute, and my close price to the LOWEST price for the minute. The goals is to be as conservative as possible. You don't want to go live and find that you were too optimistic in your fills. If you cannot narrow it down to smaller than a ...


4

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. ...


4

The formula is given in your link. For the real world probability without jump: $$x_t = x_{t-1} e^{-\eta \Delta t} + \hat{x}(1-e^{-\eta \Delta t}) +\sigma \sqrt{\frac{1-e^{- 2 \eta \Delta t}}{2 \eta}} N(0,1) $$ where: $x_t$: price $x_{t-1}$: PreviousPrice $\hat{x}$: long term mean (a parameter) $\Delta t$: Time step (one fraction) $\eta$: ...


3

If you can simulate $N$ times independent realisations of $X_T|X_t$ then SLLN says that : $\tilde{g}^N_t=\sum_{i=1}^N\frac{1}{N}G(X_T)|X_t\to \mathbb{E}[G(X_T)|X_t]$ almost surely this is classical and often the only way to get $\mathbb{E}[G(X_T)|X_t]$ for high dimensional process $X$. You can even use CLT to get a confidence interval for $\tilde{g}_t$ ...


3

I assume, this is not for real-time display, so you can use the price from future. If this is not the case, this answer is irrelevant. I don't know about a standard technique, but this is my suggestion: $p_{noise} = p_{current} + \nu * (p_{future} - p_{current})$ where $p_{future}$ is future price for some horizon, and $\nu$ is a zero-mean Gaussian noise. ...


3

For the brokerage fee, consider coding a system that calculates the fees for several brokerages (so that you can compare brokerages). For the slippage (and other issues), consider coding that in as well. Adjust prices based on the slippage percentage. Once you do that, you can vary the slippage and determine how much slippage will break your algo.


3

You could create a rescaled stochastic indicator from your randomly generated, correlated series. 1) use whatever software/methodology you want to create your random series with 0.85 correlation to the original data. 2) find the maximum and minimum values of this new series and rescale the series to range between 0 and 1 using this formula; (series_value - ...


3

The easiest answer which comes to my mind is generating correlated time series. There is a good description of the process in Part 3 of this document : http://www.columbia.edu/~mh2078/MCS04/MCS_framework_FEegs.pdf If you base your correlation input on the correlation observed in the market data you should obtain "statistically" similar time series.


3

Not sure I understand your question. If I have a fixed stream of payments it has some value $V_{fixed}$ I can always solve for a spread to LIBOR by simply adding the spread $S$ to my calculated stream of LIBOR. That is the value of the LIBOR + spread leg is $$ V_{LIBOR}(S) = \sum_{n=1}^{N} D(t_{n}) \alpha(t_{n-1},t_{n}) [L(t_{n-1},t_{n}) + S] $$ where ...



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