Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Making a code to simulate random walk

$
0
0
I don't have any programming experience, but I wanted to make a code for the following scenario:

For each successive trading day, the closing price of a stock will be determined by the flip of a fair coin. If the toss was a head, you are assumed that the stock closed 1/2 point higher than the preceding close. If tails, the price is assumed to be down by 1/2 point. (say that a time t=0, the stock price is $30).

I want to be able to plot each toss result on a graph (where "price" is the dependent variable and "time" is the independent variable) in order to simulate a random walk. Is this possible? I don't need this for anything, I was just curious.

Viewing all articles
Browse latest Browse all 51036

Trending Articles