# Simulate a time series of stock price using Monte-Carlo simulations

8 Ansichten (letzte 30 Tage)
Alessandro am 8 Mär. 2016
Bearbeitet: Rick Rosson am 8 Mär. 2016
Hy everyone, I need to compute a time series of stock price assuming that they are driven by a random walk. What would be the best way to approach the problem, i.e. the right function to do so? I should replicate it 10.000 times (N=10.000).
thanks for the help.
##### 4 Kommentare2 ältere Kommentare anzeigen2 ältere Kommentare ausblenden
Rick Rosson am 8 Mär. 2016
Use the randn function.
Rick Rosson am 8 Mär. 2016
Bearbeitet: Rick Rosson am 8 Mär. 2016
• Remember to put something in your code to prevent the stock price from falling below 0.
• Also, in the real-world, stock prices tend to drift higher over time, so the assumption of a zero mean is not realistic. The mean should be a positive number, although possibly quite small in relative terms. Furthermore, the size of the mean is usually proportional to the current price of the stock, as is the standard deviation.
• It might be interesting to consider the relative sizes of the mean versus the standard deviation of the net change per period.

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Rick Rosson am 8 Mär. 2016
Bearbeitet: Rick Rosson am 8 Mär. 2016
Here is some code to get you started:
N = 10000;
P = nan(N,1);
P(1) = ...
for k = 2:N
P(k) = P(k-1) + ...
end
figure;
plot(P);
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Monte-Carlo finden Sie in Help Center und File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by