# Theoretical optimisation of foreign exchange strategy

1. Oct 2, 2012

### jason_85

Hi everyone,

I realise this is only loosely related to mathematics, but I didn't know where else to ask this question (if I post it in a finance forum I'll get 100 different answers from people who probably didn't really understand the question). I think mathematicians are the kind of people I need to answer this question :)

Supposing hypothetically that I have an array of binary numbers, let's call it ℂ. We also have an array of integers, let's call it ∅. The length of these is identical.

Each number in ℂ is either "up" or "down", let's call them 1 and 0 respectively. Each value of ℂ at the ith position is a prediction about whether or not the price of some currency, stock, or commodity, let's call it STOCK, is going to be higher or lower than the price today, n days from now (where n is ith value of ∅).

So given that information, and given also the amount of cash held and the amount of STOCK currently held, what is the optimal course of action to theoretically maximise profit, assuming the following:

1) There is no difference between the sell and buy price, and there is no fee involved in buying or selling STOCK.
2) The prediction is not necessarily going to come true, but the accuracy can be assumed to exceed that of a random guess.

Is there a single solution to this problem? As far as I can tell there should be, right?

2. Oct 2, 2012

### Stephen Tashi

Mathematicians will tell you that you need to specify more information before you have a problem with a definite mathematical answer. We should start by revising your notation. The symbol ℂ is often used to denote the Complex Numbers. The symbol ∅ looks like the customary symbol for the null set. It also isn't clear whether you are using the terminology "array" to mean a general matrix or whether you mean a it to be a vector (i.e. a matrix with only 1 row and several columns). Show a small example of what the data looks like.

Saying that there is an aspect of uncertainty or probability to a prediction isn't specific enough to define a mathematical problem. You'll have to develop a precise description of how to model the probability that is involved.

That said, the problem of optimal trading is very interesting and a specific version of it involving more than 2 stocks is likely to be unsolved. (If you browse titles of academic papers on trading, you find most of them deal with switching assets between 2 things. Not with optimal strategies for many things.)

3. Oct 2, 2012

### jason_85

Thanks for the response Stephen.

Sorry for highjacking symbols. Let me rephrase it so it's clearer. Let's call the two 1D arrays (vectors?) PRED and DATE respectively, where PRED contains a list of binaries representing the prediction and DATE contains integers specifying the number of days into the future. So on any given day we might have:

PRED = [1,0,1,0,0,...]
DATE = [1,3,4,8,32,...]
ACCU = [0.6,0.59,0.52...]

So this vector set tells us that tomorrow (i = 0 using zero-base notation) the price is predicted to be higher than it is today, 3 days from now (i = 1), it is predicted to be lower than today, etc.

DATE never changes, but PRED can at every time step (ie. every day).

I have also added a vector ACCU, which describes the historic accuracy of the corresponding prediction value. The ith value of ACCU describes the historic accuracy of the ith PRED values (so for i = 0 it describes the historic accuracy of predictions 1 day into the future). We can tentatively take the values of ACCU to represent the likely accuracy of the prediction (although the variance in those values is likely to be large). As the time over which the investment scheme is carried out approaches a large number, the precision of the ACCU values will converge on the "real" value, so I suppose we can take the contents of ACCU to represent the best guess for the precision of the predictions.

I should add that what I am after is optimisation of the risk-weighted return. That is, the greatest possible return assuming that the investment scheme is carried out over a period approaching infinity (ie. the occurrence of all events approaches the probability itself).

Last edited: Oct 2, 2012
4. Oct 2, 2012

### Stephen Tashi

To define an financial optimization problem, I think you'll need more than yes-or-no kinds of data. For example, knowing the price will be higher, doesn't tell us how much higher. Knowing the "accuracy" is 0.6 sounds like that means there is a 0.6 probability that forecast will be right. But if the forecast is wrong, it could be wrong by various amounts.

To utterly simplify the situation and use the data you provided, we could assume the stock price rises by $1 per share if the prediciton of "1" is true, falls by$1 a share if the prediciton of a "1" is "not accurate". But is that a realistic model for a stock price?

You also must define the choice of strategies is available for buying or selling the stock. Are we supposed to decide when to buy once and when to sell once? Or do we keep buying and selling? If we buy and sell several times, may we reinvest profits? Is our initial capital limited?

5. Oct 2, 2012

Currently the only information I have available is that the values will either rise or fall. The amount is not specified. Let's, for now, simplify it to make the amount irrelevant. Suppose you have $1, and I tell you the following: 1) That there is a chance higher than 50% that the Australian dollar will be cheaper with respect to the US dollar tomorrow 2) if my prediction is wrong the amount by which the US dollar will drop is likely to be equal in magnitude to the gain you would have foregone had I been correct. 3) daily fluctuations in currency are historically small. In this scenario, it makes economic sense to use all of your money to buy US dollars today, and buy Australian dollars with that sum tomorrow. You don't need to know the amount to know that this is a good decision, assuming that there is no fee in exchanging and buy/sell spreads are 0, and assuming that 3) holds true for the future. Let's assume for now that 2) and 3) are true for all of the predictions that the model is given. The model can decide when to buy and sell, and by how much. It should be given an initial starting combination of stock and cash (they can be currency a and currency b, not necessarily a stock/cash combination) at every time step (these can be an initial value, or the result of a previous decision it has made), and is then free to make any decision at the given time step (or make no decision). I would like the model to act only on information given to it at the start of each day. It does not have memory, and it does not make decisions for tomorrow based only on today. Every day I want it to take an action, a series of actions, or no action, that best serve its long-term interests (e.g. it could buy today, knowing that tomorrow it will sell if the information available to it then makes such an action profitable). Basically, what I want is a system for accumulating when the price is going up, and selling when it is predicted to drop. But the question is, when and how much, given these assumptions? Is it even possible given the information given? Last edited: Oct 2, 2012 6. Oct 2, 2012 ### Stephen Tashi That isn't necessarily true as a repeated strategy because it carries a higher risk of "ruin" than a more conservative approach. For example, see this recent thread on Kelly betting: https://www.physicsforums.com/showthread.php?p=4083644 If you know this is a good decision then can you illustrate a situation where the best decision isn't known? I think you'll have to attach some quantitative amount to the rise and fall, but we can postpone that. First let's clarify the timing. I assume the model goes in discrete steps, Let's say at step 0 we have U[0] U.S. dollars and A[0] Australian dollars. We have a prediction of "1" and its accuracy is 0.6. The exchange rate is 0.8 U.S. dollars per 1.0 Australian dollars. We make a decision to exchange a certain amount of one currency for the other. (Or do must we exchange our entire holding of one currency for the other? ) Then step 1 happens. We begin with U[1] U.S. dollars and A[1] Australian dollars. At step 0, do we see all the data for the future? Or only the prediction and accuracy data for the next day? What quantity are we trying to optimize? Given there is probability involved, I assume we are tyring to optimized some "expected" value or rate-of-increase-in-assets. Since the exchange rate varies, how do you define the current value of your assets? - or is this one of the questions that must be investigated? Let's assume for now that 2) and 3) are true for all of the predictions that the model is given. The model can decide when to buy and sell, and by how much. It should be given an initial starting combination of stock and cash (they can be currency a and currency b, not necessarily a stock/cash combination) at every time step (these can be an initial value, or the result of a previous decision it has made), and is then free to make any decision at the given time step (or make no decision). I would like the model to act only on information given to it at the start of each day. It does not have memory, and it does not make decisions for tomorrow based only on today. Every day I want it to take an action, a series of actions, or no action, that best serve its long-term interests (e.g. it could buy today, knowing that tomorrow it will sell if the information available to it then makes such an action profitable). Basically, what I want is a system for accumulating when the price is going up, and selling when it is predicted to drop. But the question is, when and how much, given these assumptions? Is it even possible given the information given?[/QUOTE] 7. Oct 2, 2012 ### jason_85 Yes, this is somewhat of an issue. I tried to address this earlier by simply adding the assumption that the fluctuation in currency can be assumed to be small, such that a "kelly bet" does not exist because risk of total loss is 0. I think so. Let's suppose you have$100 of cash. The model is given the following STOCK, PRED and ACCU vectors:

PRED = [1,0,1,1,0]
DATE = [1,2,3,4]
ACCU = [0.55,0.7,0.55,0.6,0.5]

Ignoring the ACCU vector, the best decision is always going to be simply "if PRED[0] == 0, sell everything, else buy everything". But taking this scenario, we know that there is a 55% of the price rising tomorrow, so we should buy. However, there's an even higher chance of it dropping in 2 days. Should we buy today, sell tomorrow and buy again in 2 days, or sell today and buy in 2 days? Assuming that the fluctuations are always equal in percentage, is the answer still just to buy today?

8. Oct 2, 2012

### jason_85

I see the merit in your criticisms, and I'm now worried that I've over-trivialized the problem with my assumptions. I could go back to the drawing board and develop a model that will produce actual predictions for the values of the numbers, along with the likelihood of accuracy. However, getting to this point was already a herculean task in itself and I was hoping to at least model the behavior of an investment system with the given data. Maybe I'll just go with "if PRED[0] == 0, sell everything, else buy everything" for now and see how that goes!

Modern markets are among the most complex systems known to man, and even just that binary system took 20 Petaflops to nut out. I'm worried I'll die before it solves a problem with actual price predictions...

Last edited: Oct 2, 2012
9. Oct 2, 2012

### Stephen Tashi

I'm glad to see a reference to computers. Simulation is very powerful tool.

I think modeling currency trading is complicated by the fact that if you "sell" you must get paid in some currency or commodity, correct?

In another thread, I mentioned that it appears hard to compute optimal strategies for trading several stocks even when the future is perfectly known: https://www.physicsforums.com/showthread.php?t=488995 I didn't get much discussion of the problem!

10. Oct 30, 2012

### horseguards

My apologies for the late response.

I'm am far from being a mathematician but I do have experience of the markets.

What you are looking for will amount to no better than curve fitting (I presume historic data is used). You could do this on your desktop PC running Excel (petaflops?). There are also many low-priced, off-the-shelf programmes to do the same.

In the final analysis, no amount of optimisation derived from a set of rules can produce a viable model for profiting from randomness.