Consider the simplfied math. model for asset price (it is nevertheless quite practical for specific situations see "PS" part below) assume price "p(n)" at moment "n" is equal to N(0,1) - i.i.d - independent Gaussians.

Assume we can possess not more than one asset in any moment. I.e. if buy it we can keep it or sell it, but cannot buy another until we sold the previous one.

Our profit is accumulation of differences between the prices we bought and sold.

Informal Question What are the "best" trading strategies ?

Mathematically rigorous Question 1 What is the strategy which will maximize expectation value of the profit for trading time n=1...N ?

Conjecture (YES/NO) Is it true that the answer to the question above is given by the following simple strategy if the price is greater than zero - sell, if less than zero buy. See MatLab code for details.

Variations on the question
Profit here is random variable, and what means "best" random variable is ambiguous. The simplest version is to take expectation as in question above, but more profound measures of quality can be something like E(profit)/std(profit), I mean taking "risk" into account.

Here is MatLab code for simple strategy - buy if price < threshold1, sell if price > threshold2. Results of simulation suggests that best choice is threshold1=threshold2=0. It motivates the conjecture above.

enter code herefunction profit = TradeStrategy2(threshold1, threshold2 )

len = 1e6;
p =  randn(1,len);

flagBought = 0; profit = 0;
for k=1:len
    if (p(k) < threshold1 ) && (flagBought == 0)
        pSave = p(k);
        flagBought = 1;
    elseif (p(k) > threshold2 ) && (flagBought == 1)
        profit  = profit  + (p(k)-pSave) ;
        flagBought = 0;
fprintf(1,'Strategy 2, threshold1 =, %f, threshold2 =, %f profit/len = , %f, \n ', threshold1, threshold2, profit/len );

profit = profit/len;


Simulation results:

Strategy 2, threshold1 =, -0.000000, threshold2 =, 0.000000 profit/len = , 0.398951,

Strategy 2, threshold1 =, -0.100000, threshold2 =, 0.100000 profit/len = , 0.395956,

Strategy 2, threshold1 =, -0.100000, threshold2 =, 1.000000 profit/len = , 0.281029,

Strategy 2, threshold1 =, -1.000000, threshold2 =, 0.100000 profit/len = , 0.281722,

Strategy 2, threshold1 =, -1.000000, threshold2 =, 1.000000 profit/len = , 0.242517,

Strategy 2, threshold1 =, -3.000000, threshold2 =, 3.000000 profit/len = , 0.004250,

Similar questions can be asked for arbitrary random process. I guess, that the general answer should also be known, however I have not yet received answer at



Motivation for considering such simplified model of the price is the following. Consider the "trend" part of some real price, the simplest model for the trend is linear trend: p(t) = At + B + noise. The most simple situation is to take A=0. So we almost come to our model. Please notice that choice of "B" does not affect the optimal stategy, so we can assume it to be zero.

However, physiologically, it is better to assume it to be B = million or billion - very big number. It will explain the second assumption of the model - you cannot buy two assets at one time - that it is just because your resources are limited - you have 1 million (or billion), but not two.


3 Answers 3


First, you're surely asking the wrong question, in the sense that a real-world asset price will look much more like a random walk than a series of independent draws from the same random variable. (That is, you should be modeling price changes, not prices, as drawn independently and identically (presumably from something like a lognormal distribution).

Second, if we nevertheless choose to take your model seriously, your tolerance for risk is presumably a function of your accumulated wealth, which makes each period's optimal strategy a function of earlier periods' realizations. The precise function will, of course, depend on exactly what you're trying to maximize.

Third, if you had modeled the asset price as a random walk, with a lognormal distribution of price changes, then among all strategies with a given expected return, the one that minimizes variance is the one that keeps the value of your investment constant at some level $\$N$ (where $N$ depends on the chosen expected return). So if you start the period with $\$K$ invested, you should invest an additional $\$(N-K)$ (whether positive or negative). The simple intuition is that this spreads your risk evenly across all periods, which is better than putting more eggs in some baskets than others.

(This ignores your assumption that you can only hold one share of the asset at a time, but that again is a very strange assumption --- it would be far more natural to assume a constraint on how much you have invested, i.e. a bound on $PQ$ where $P$ is price and $Q$ is quantity, instead of your bound on just $Q$.)

  • $\begingroup$ Thank you for your comments, it helps me to improve (hopefully) the question. I sincerely hope you will modify yours answer accordingly. $\endgroup$ May 31, 2013 at 19:22
  • $\begingroup$ Given the OP's trend+noise idea, do you have an argument for why prices should be modeled as price changes, rather than prices? $\endgroup$ Jun 1, 2013 at 1:31
  • 1
    $\begingroup$ As to the original question, the conjecture is, indeed, true for every symmetric distribution. I'm not sure how practical it is to bet on the stock movements according to that model, but gasoline prices seem to follow a law like that lately, so one can try to optimize the average fuel cost and to see if there is a noticeable advantage compared to the usual "refuel when empty" strategy. The extra difficulty there is that while you are fine waiting with the stock, you cannot wait too long between gas tank refills. $\endgroup$
    – fedja
    Jun 1, 2013 at 4:24
  • $\begingroup$ @fedja " the conjecture is, indeed, true for every symmetric distribution." please can you say more on that ? I would accept answer proving it. I am very interested. $\endgroup$ Jun 1, 2013 at 8:34
  • $\begingroup$ Joel: There are two reasons to be skeptical of the "trend plus noise" model, neither of them strictly mathematical. First, it's almost impossible to incorporate this model into an equilibrium model in which profit-maximizing traders respond to a price process and thereby change that process. (More prosaically, this model allows for unexploited profit opportunities, whereas we ordinarily assume that unexploited profit opportuntities lead to trading behavior that causes those opportunitites to vanish.) The second reason is the empirical evidence from real world financial assets. $\endgroup$ Jun 1, 2013 at 13:30

I'm not sure if I understand the model correctly as it seems to me that the answer here is very natural if you reinterpret your model in terms of expected "price increments" ("price changes"). The model assumes that the price level - not change - is given by N(0,1). Thus every time the price is positive the expected increment is negative. If the price level is negative the expected increment is positive. Therefore, the optimal strategy can be stated as: buy if the expected increment is positive and sell if it is negative. Of course it is exactly the conjectured optimal strategy.

  • $\begingroup$ In this question I am intentionally consider NOT the increments to be N(0,1), but the price itself. Let us forget about - is it relevant to real world or not (I think it is relevant in "trend case"). The question is mathematically well-defined on its own. About the increments there is another question - "One can earn nothing on the Brownian motion, true ?" mathoverflow.net/questions/132581/… $\endgroup$ Jun 3, 2013 at 10:48
  • $\begingroup$ @Alexabder My answer fully takes into account the fact that you do NOT consider the increments to be N(0,1). My answer says that if the PRICE changes according to N(0;1) iid then ... $\endgroup$
    – Waldemar
    Jun 3, 2013 at 10:51
  • $\begingroup$ Waldemar, I am sorry, you are right. It seems you gave the answer I hoped, let me think for some time. $\endgroup$ Jun 3, 2013 at 12:44
  • $\begingroup$ Hm, but why are you sure it is optimal strategy - naively I may think that I want: not just positive increment, but increment > threshold, i.e. I do not want to earn small money, but will wait for some "good" money. $\endgroup$ Jun 3, 2013 at 12:52
  • $\begingroup$ @Alexander No problem. You're welcome. By the way, your model could be treated as a textbook example of a situation when you should apply "Mean-reversion trading". $\endgroup$
    – Waldemar
    Jun 3, 2013 at 12:53

As I already replied to your QSE question, almost any kind of such problem can be solved by means of the dynamic programming discovered by Bellman and deepened by such people as Bertsekas and Shreve to name a few. Btw, the joint work of the latter two, "Stochastic Optimal Control" is one of the best in the field. So are the books written by Shreve on the stochastic analysis and stochastic finance.

No matter which evolution (in discrete-time) of the assets/group of assets you assume, as long as it can be restated in the Markovian form (perhaps, giving up the number/finetness of dimensions), you can apply stochastic optimal control principles as per the reference above. the framework is rather broad - namely you can deal with Borel spaces which is often enough in practice. Moreover, even optimal stopping problems or double optimal stopping problems like the one you are interested in, can be restated as classical additive cost problems if you use enough of auxiliary variables.

Even writing the dynamic programming recursions/fixpoint equations often gives some intuition for the shape of the optimal strategy. In general, of course, its worth computing the strategy and the value of the optimal control problem - and there is a whole range of approximate dynamic programming methods to you service.

I believe, Waldemar has given a nice answer to your question which didn't require any involved techniques. Let me show though how DP would work.

We have the following Markovian model for the capital of the trader $$ \mathbf x_{k+1} = \mathbf x_k + \mathbf u_k(\mathbf z_{k+1} - \mathbf y_k) $$ $$ \mathbf y_{k+1} = \mathbf z_{k+1} $$ where $\mathbf z_k\sim N(0,1)$ is a price, $\mathbf u_k$ is your control variable: it's $1$ when you hold the asset and $0$ otherwise. Also, $\mathbf y_k$ is an auxiliary variable that we use to account for the correlation in price changes.

Let us fix a time horizon $N>0$, so that the final reward is $r_N(x,y) = x$. We don't have any running cost, so $r(x,y) = 0$. Let $J^*_n(x,y)$ denote the optimal value on the horizon $[n;N]$, so that $$ J^*_N(x,y) := c_N(x,y) = x $$ and we have recursions $$ J^*_n(x,y) = \max_u \int_{\Bbb R^2} J^*_{n+1}(x',y')Q(\mathrm dx'\times \mathrm dy'|x,y,u) $$ where $Q$ is the transition kernel derived from the update equations above.

Now, by simplifying the dynamics above you get iterations

$$ J^*_n(x,y) = \max\left(\Bbb E {J^*}_{n+1}(x,Y),\Bbb E {J^*}_{n+1}(X + x-y,Y)\right) $$

where $\Bbb E$ is taken w.r.t. to iid $X,Y\in N(0,1)$. Doing computations by hand, you'll get for $n = 0,1,2,\dots,N-1$ that $$ J^*_n(x,y) = x + (N-n-1)\gamma + y^- $$ where $y^- := \max(0,-y)$ and $\gamma := \Bbb E Y^-$. Whenever in your iterations you have to find the maximum, you get the optimal decision for $u$. In such a case you just have to decide whether $x$ (corresponding to $u = 0$) or $x-y$ (to $u=1$) is bigger, so that the optimal policy is buy/hold when the price is negative, and sell/don't buy if the price is positive which agrees with outcomes in other answers. The total expected reward is hence $$ J^*_0(0,0) = (N-1)\gamma. $$

  • $\begingroup$ Thank you, nevertheles I guess in this particular case the answer can be obtained without general theories. $\endgroup$ Jun 3, 2013 at 10:49
  • $\begingroup$ @Alexander: I extended my answer just to give a flavor of how the method works. Yet again, if you just change some parameters in your model, the procedure stays the same - and you can immediately see whether you'll get a change in the optimal policy. $\endgroup$
    – Ilya
    Jun 3, 2013 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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