Skip to content
All library documents

Simulating OHLC Prices from Intraday Price Paths

Article Quant Q&A · Author: Amit

Summary

The document proposes generating high, low, open, and close values by simulating a sequence of intraday prices, then grouping those observations into daily bars. In the example, random returns are cumulatively summed to create a price path; the first and last observations supply the open and close, while the maximum and minimum supply the high and low. The answer describes a discretized path approach rather than trying to simulate the three daily price dimensions independently.

This provides a basic way to make internally consistent OHLC observations from a finer-grained path. However, the response itself expresses uncertainty about the method. Its example uses normally distributed additive returns and an arbitrary starting level, rather than the geometric Brownian motion described in the question. It does not establish that the simulated paths match empirical stock behavior, and the choice of intraday sampling frequency affects the observed extremes. No validation or comparison with market data is presented.

Key ideas

  • Generate a fine-grained price path and aggregate its observations into daily bars.
  • Use the first and last intraday observations as the open and close.
  • Use the maximum and minimum path values as the high and low.
  • The proposed example is not validated and does not model empirical price behavior in detail.

Tags

Full text
# Simulating Stock's close, high and low prices


# Simulating Stock's close, high and low prices












I am testing a model in which I need to simulate closing, high and low prices (i.e. 3 dimensions of prices) of any given stock. Using the simple Geometric Brownion Motion equation I can easily simulate the closing stock price (i.e single dimension) at each step. However I am totally confused how to simulate the other 2 dimensions i.e high and low in such a manner that they dipict the possible price movement of the stock?

Thanks in advance!!

## Answer by Alexander Didenko (score 1)

https://quant.stackexchange.com/a/16497

I use straightforward approach:

- Generate "returns";

- Make cumulative sum of returns from Step 1;

- Take any Nth (N should be "big enough") point for series obtained on Step 2. That would be "closes";

- Then take max and min between "closes" = highs and lows.

In R:

```
n <- 10000 # quantity of "ticks" inside 1 day
m <- 200 # number of days
rets <- rnorm(n*m)
price <- cumsum(rets) + 1000 # start from "big" figure, so that "price" stays positive
price.daily <- matrix(price, byrow = T, nrow = m, ncol = n)

ohlc <- data.frame(open = price.daily[,1], 
                   high = apply(price.daily, 1, max), 
                   low = apply(price.daily, 1, min), 
                   close = price.daily[,n])
```

Frankly, I'm not sure if I'am right from the methodological point of view. So, would be interesting to have some feedback.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.