3
$\begingroup$

I want to create a random (quasi random) process which goes through pre determined points and constraints. E.g. I have a daily price series but want to generate intra-day prices with the same OHLC properties.

Also I am exploring the possibility to control of the moments (mean, variance, skew, kurtosis, ...) of the process also.

Main problem here is I have low frequency data (daily) from which I want to construct high frequency data, going though all the lower frequency sampling points.

$\endgroup$
7
  • $\begingroup$ You should give more details to the purpose of the operation. $\endgroup$
    – SRKX
    Commented Dec 11, 2011 at 17:00
  • $\begingroup$ To generate a higher frequency set of test data. $\endgroup$ Commented Dec 11, 2011 at 17:02
  • $\begingroup$ Then, you shouldn't do it. Think about it. $\endgroup$
    – SRKX
    Commented Dec 11, 2011 at 17:12
  • $\begingroup$ This will be better for additional simulated back-tests. Historic data per ticker is any way one series only. $\endgroup$ Commented Dec 11, 2011 at 17:24
  • $\begingroup$ Agreed with SRKX. This is just as bad as your random but correlated request. Backtesting against fake data will only produce useless conclusions. If you truly are a quant trader, then spend the money for proper historical data. Because what you're asking for makes it sound like you don't do this for a living. And if you aren't a professional quant (or in a related academic field), then this isn't the forum for you. Please read the revised FAQ. $\endgroup$ Commented Dec 11, 2011 at 17:30

3 Answers 3

6
$\begingroup$

I have low frequency data (daily) from which I want to construct high frequency data, going though all the lower frequency sampling points.

Bad idea in my opinion. I don't really know why you really want to do this (what's are you going to do with the generated data). If it's for backtesting purposes, it's a really bad idea as there are so many mechanisms that occur at HF, it wouldn't be realistic.

Back to your question on "constrained" Stochastic Process. Mathematically, the question is as follows:

Let the $\text{OLHC} = \{o,l,h,c\} $ be the open-low-high-close over a period $\Delta t$.

You would have to create a process $X$ which represents the increment of a process $Y$ such that $Y_{t+\Delta t}=X_{\Delta t}+Y_t$ with

$X_0=0$

$X_{\Delta t}=c-Y_t=Y_{t+1}-Y_t$

$\max_{s \in \left[0;\Delta t\right]}(X_s)=h-Y_t$

$\min_{s \in \left[0;\Delta t\right]}(X_s)=l-Y_t$

And this is quite complicated to do. I believe you wouldn't be able to use a "straightforward" process.

The biggest task would be to make sure that $X$ hits the high and low. To do so, you could try and "split" $X$ in 3 phases represented by 3 processes:

  1. go and hit the high
  2. go and hit the low
  3. reach the close.

You could try and play around with these processes (inverting the two first ones to randomize a bit more).

An idea has been provided in answer (that was then deleted) for a model for each of these three processes: a Brownian Bridge.You can look at the general case at the bottom of the article, it suits your needs.

But again, I don't think it's a really good idea to do so.

$\endgroup$
7
  • $\begingroup$ If you think this is not a good way, I would like to know how you would go about it. For this purpose posted another question to get answers on this. I would appreciate if you can leave and answer. Thanks again for taking the time to answer this question. $\endgroup$ Commented Dec 12, 2011 at 10:51
  • 4
    $\begingroup$ @SumindaSirinathSalpitikorala :If you're satisfied with the answer (of this and your other questions) please mark them as accepted. $\endgroup$
    – SRKX
    Commented Dec 12, 2011 at 11:02
  • $\begingroup$ @SumindaSirinathSalpitikorala: How is this an acceptable and satisfactory answer? Even the notations do not make sense. I have no idea how the "three" phases are and how they could be put together. Does anyone else understand what is proposed here? $\endgroup$
    – Hans
    Commented Dec 22, 2013 at 19:11
  • $\begingroup$ @Hansen perhaps instead of sounding so condescending you could try to explain us what it is you don't understand. I'll try to update the formatting. Because given the +6 score, I'd say that say, people understood what I meant. $\endgroup$
    – SRKX
    Commented Dec 23, 2013 at 14:30
  • $\begingroup$ @SRKX: I apologize for sounding that way. I was just frustrated that the solution did not carry more information than repeating what the question asked for and the notation for $X$ and $Y$ is unnecessary and messy. 1) Regarding the three phases. It essentially repeats what the question asks for (OHLC means exactly 1. hitting the high, 2. hitting the low, 3. ending at the close). It does not give an algorithm. For example, when should the first two phases occur? How random or what is the joint distribution of the hitting times? $\endgroup$
    – Hans
    Commented Dec 23, 2013 at 16:01
4
$\begingroup$

I think a simple solution is to try to construct a Brownian motion $W_t$ through known points (e.g., $W_0 = W_1 = 0$); it is also known as a Brownian Bridge [ http://en.wikipedia.org/wiki/Brownian_bridge ].

See also question 3 in http://www.math.nyu.edu/faculty/goodman/teaching/StochCalc2012/assignments/assignment4.pdf .

$\endgroup$
3
  • 1
    $\begingroup$ He's looking to match OHLC here, not only a random path between 2 points... $\endgroup$
    – SRKX
    Commented Nov 1, 2012 at 19:37
  • $\begingroup$ Since the OP wanted to "generate intra-day prices with the same OHLC properties", maybe one way to account for the high-of-the-day (HOD) is to note the time of the actual HOD, and add an additional fixed point to the Brownian bridge. Specifically, if the process is $X_t$, and let $X_{t_O} = x_O$, $X_{t_H} = x_H$, $X_{t_C} = x_C$, and $t_O \leq t_H \leq t_C$. Build a Brownian bridge that goes through the three points. We can handle the low-of-the-day similarly. $\endgroup$
    – wsw
    Commented Nov 6, 2012 at 20:33
  • $\begingroup$ This is not guarandeed to match the actual HOD as it might easily get higher earlier and then revert back. $\endgroup$
    – Quartz
    Commented Jul 11, 2013 at 15:29
1
$\begingroup$

Suppose the logarithm of the price follows a standard Brownian bridge from $O$ to $C$ hitting high (maximum) of $H$ and low (minimum) of $L$ on the way. The paths can be constructed with the application of the reflection principle.

Take first the simpler task of constructing Brownian paths with OHC property. We start with a Brownian bridge connecting the opening price $O$ at opening time $t=0$ with price $2H-C$ at closing time $t=1$. Amongst the paths constructed, delete the ones cross below $H$ from above after having crossed above $H$ from below for the first time. For each of the remaining path, reflect the part beyond the stopping time of first crossing $H$ around $H$.

The original task can be accomplished by repeatedly and carefully applying the exact same principle of reflection. The algorithm is a bit more complicated though. We divide all the path into disjoint subsets be sequence of hitting time of $H$ and $L$ between the opening point $O$ (let's set the price of $O$ at $0$ and starts at time $0$ and ends at time $1$) and closing point $C$. In the following description of the algorithm, I am going to sacrifice rigour for sake of descriptive simplicity --- until someone asks questions and ask me to filling th details. A path possessing the required property will start from $0$ and alternatingly hit $H$ and $L$ then end at $C$. Let $h_k$ be the stopping time of the path hitting price $H$ for the $k$'th time after the path hits $L$. So between $O$ and $C$, the set of hitting time sequences in order of occurrence is $\{(h_1,l_1),(h_1,l_1,h_2),(h_1,l_1,h_2,l_2),...\}$ union with $\{(l_1,h_1),(l_1,h_1,l_2),(l_1,h_1,l_2,h_2),...\}$.

The paths generating each hitting time sequence correspond to a subset of Brownian bridges emanating from $0$ and ending at different price points $p$ at time $t=1$ with density proportional to $e^{-p^2}$. Let $k$ run through all natural numbers. For $(l_1,h_1,...,l_k,h_k)$, the Brownian bridge ends at $p=C-2k(H-L)$; for sequence $(l_1,h_1,...,l_k)$ it ends at $p=-C-2k(H-L)+2H$; for $(h_1,l_1,h_2,l_2,...,h_k,l_k)$, it ends at $p=C+2k(H-L)$; for $(h_1,l_1,h_2,l_2,...,h_k)$, it ends at $p=-C+2(k-1)(H-L)+2H$. Amongst all the Brownian bridge paths thus constructed any path hitting any price line in the set $B=\{H+i(H-L): i\in \mathbf Z\}$ for consecutively the second time is eliminated.

Now fold or reflect all thus constructed along the price lines of $\{H+i(H-L): i\in \mathbf Z\}$. The paths thus formed are those required.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.