May 21, 2012

**Designing Trading Rules**

If you want to implement an “enhanced” trading strategy **H**^{+ }based on buying and selling functions and/or procedures, your primary objective, as before, is for your portfolio to exceed the Buy & Hold, performance-wise.

Σ( **H ^{+}** .* Δ

**P**) = Σ((

_{?}**H**

_{H}+

**B**-

_{?}**S**) .* Δ

_{?}**P**)

_{?}**>**Σ(

**H**

_{H}.* Δ

**P**)

_{?}It should be evident that **B**_{?} > **S**_{?} is a requirement, or more explicitly, that Σ(**B**_{?} – **S**_{?}) > 0. It would seem as if whatever trading strategy you might wish to devise, one of its basic tenets should be: Σ(**B** – **S**) > 0, meaning that the net overall trading needs to be positive as a result of more buying than selling. And if you buy more shares than you sell, the inventory will increase.

The last statement implies that one should look at accumulative functions as a solution to the trading problem. This way, Σ(**B** – **S**) > 0 would grow with time. The inventory level of each stock would increase over the 5,000 trading days of portfolio life. And letting the inventory grow over time can be about the same as adopting a Buffett-like profit reinvestment policy.

It all seems so simple, really.

In a random-like environment where all trades are closed, all trading would tend to generate zero accumulated inventory as in Σ(**B** – **S**) → 0. This would be like saying any enhanced trading strategy would tend to generate zero alpha.

Σ( **H**^{+} .* Δ**P**_{SPY}) → Σ(**H**_{H} .* Δ**P**_{SPY}) → **α** → 0

As a result, just buying and selling might not be sufficient as a trading strategy to improve performance. Should: Σ(**B** – **S**) → 0; once again one would get:

Σ(( **H**_{H} + **B** - **S**).* Δ**P**_{SPY}) → Σ(**H**_{H} .* Δ**P**_{SPY})

If you are not accumulating any additional inventory, then profits generated by the trading process might simply accumulate as cash reserves in the account. The trading process: Σ((**B** - **S**).* Δ**P**) can still generate profits even though all trades have been closed. The profits generated by the closed trades could be fed back into the system if desired to progressively increase bet size as profits accumulate, undertake an accumulation program, or simply be left accumulating in the account.

Then, the trading strategy generating the payoff: Σ((**B**_{?} - **S**_{?}).* Δ**P**_{?}) takes a life of its own. In the Buffett scenario, all you had to do was generate a trade imbalance Σ(**B**_{?} - **S**_{?}) > 0 to achieve alpha. Adding a selling matrix to the mix opens the door to any kind of trading strategy one would want to implement. Sure, if Σ(**B** – **S**) > 0, it will leave a bigger inventory on hand and thereby generate some alpha. But the trading process itself, with its closed trades, can also generate profits: Σ((**B**_{?} - **S**_{?}).* Δ**P**_{?}) > 0.

Then, one should look at the whole process as having two objectives: one would be to accumulate shares over the portfolio's life, and the other to trade over this accumulative process. Like trying to gain on both fronts. The payoff matrix in its simplicity hides what is going on under the hood, it does not make reference to time, when just expressing Δ**P** implies time.

Any price series could be expressed as:

P_{i} ( t) = P_{i} _{o} + Σ^{t} ΔP_{i}

where the price series is simply the initial price to which is added the cumulative sum of all price variations. Therefore, what is looked for is Σ^{t} ΔP_{i} > 0 for long positions and Σ^{t} ΔP_{i} < 0 for short positions. To obtain Σ^{t} ΔP_{i} > 0 for long positions requires a time of unknown duration. Then profit-seeking becomes a search for these Σ^{t} ΔP_{i} > 0, a search for tradable opportunities.

You have this payoff matrix: Σ^{t} (( **H**_{H} + **B**_{?} - **S**_{?}).* Δ**P**_{?}), a 100 stocks by 5,000 trading days matrix, and you want to find how many Σ^{t} Δ**P**_{i} > 0 there are. ΔPi can be positive from a time duration of one day up to 5,000 trading days and all numbers in between. In total, there will be some 500,000 price variations in the Δ**P** matrix just for the daily operations. But one should also count all other durations: from 2, 3, …, up to n = 5,000 as other possible time intervals.

## Trading Decision Matrix

There is a need for a decision process, a decision surrogate that will provide the reason to undertake a trade (entry and possible exit).

Σ^{t} (( **H**_{H} + **B**_{?}**DB**_{?} - **S**_{?}**DS**_{?}).* Δ**P**_{?})

where **DB**_{?} and **DS**_{?} are the decision surrogates matrices governing the buying and selling operations, respectively. With the introduction of decision surrogates comes the notion that market information, skills, or knowledge may help in the decision process.

So here we are with an unknown price variation matrix Δ**P**_{?} (100 by 5,000) with unknown buying **B**_{?} and selling **S**_{?} procedures and functions controlled by unknown decisions surrogates **DB**_{?} and **DS**_{?}. What should be the best course of action amongst the googols and googols of possibilities?

There is a need to break down the trading process further by examining the possibilities. What is looked for is how things interact to provide positive performances and, from there, find ways to structure the decision surrogates to do the job.

A trading system can be composed of initial shares bought to hold long-term, the positions still opened, and the set of closed positions:

Σ^{t} (( **H**_{H} + **B**_{?} - **S**_{?}).* Δ**P**_{?}) = Q_{t=0}P_{t=0} + Σ^{t}_{n}(**Q**_{k=h, k≠ 0})**P**_{t} + [ Σ^{t}_{n}(**Q**_{k=s})**P**_{t} - Σ^{t}_{n}(**Q**_{k=s} **P**_{t}) ]

For each stock * i* in the portfolio, all the trading operations can be summarized with the above value expression:

Q_{t=0}P_{t=0} : the value of initial purchases at time t = 0

Σ^{t}_{n}(**Q**_{k=h, k≠ 0})**P**_{t} : the value of still opened positions, excluding initial positions

Σ^{t}_{n}(**Q**_{k=s, k=t})**P**_{t} : the proceeds from all sold positions

Σ^{t}_{n}(**Q**_{k=s, k=t}**P**_{t}) : the cost of all closed positions

There is a need for a process of creating trade imbalances that can generate enhanced holding matrices by designing inventory accumulation functions. You let the inventory levels fluctuate over the stock accumulation procedures; and let Σ(**B**_{?} - **S**_{?}) increase in time.

**Trade Imbalances**

If you **B**(uy) more than you **S**(ell), for whatever reason, then Σ(**B** – **S**) is greater than 0 and is just a consequence of your trading methods and procedures. If Σ(**B** – **S**) > 0, then you have achieved:

**H ^{+}** =

**H**

_{H}+

**B**-

**S**an enhanced holding matrix.

It would be like saying, you buy 500 shares of P_{?}, wait for a ΔP_{?} > 0 or ΔP_{?} > T (some profit threshold), and sell only part of your purchase, leaving, say, 100 shares in your growing inventory. You can use the proceeds from the sale to buy more stocks and repeat the process as long as the price fluctuates enough to generate some profits. This trade imbalance will accumulate with time as your inventory grows. At the same time, you will be pumping cash back into the system to give it the ability to purchase more shares in the future.

The next step seems to devise ways to implement those trade imbalances over the long term which would result in improving performance above the Buy & Hold: **H**^{+} > **H**_{H}, which was the primary objective in the first place.

As a simple example: let Σ(**B** – **S**) → Σ **H**_{H}, which would translate to over 5,000 trading days to trade and accumulate as many shares as the initial quantity purchased on day 0, and this will tend toward doubling the accumulated profits:

Σ(**H ^{+}** .* Δ

**P**

_{SPY}) → Σ( 2

**H**

_{H}.* Δ

**P**

_{SPY})

Therefore, adding buying and selling matrices will improve performance as long as there is more buying than selling, as long as a trade imbalance is generated in favor of the buying matrix: **B** > **S**. And when considered at the portfolio level, for say Δ**P**_{?}, the above would be expressed as:

Σ(**H ^{+}** .* Δ

**P**

_{?}) → Σ( 2

**H**

_{H}.* Δ

**P**

_{?})

and would imply that the difference between the buy (**B**) and sell (**S**) matrices would have, over the course of the portfolio's life, accumulated the equivalent of their respective initial purchases due to their trading operations. A portfolio Δ**P**_{?} was set as 100 stocks from the S&P500 times 5,000 trading days. The **B** and **S** matrices will be of the sparse variety of the same size as Δ**P**_{?} and mostly filled with zeroes but will contain all the quantities traded in each stock based on their respective decision surrogates.

Any factor, linear or exponential, that would enhance the trading procedures to increase this positive imbalance could have for result an increase in overall generated profits simply due to this increasing inventory. And it would appear an assumption that could be made, might be to have a long-term positive price differential, as in P_{SPY}(t) - P_{SPY}(t=0) > 0 over the long haul. And even this long-term assumption, P_{SPY}(t) - P_{SPY}(t=0) > 0, might not be necessary. Even on a flat SPY, the trading procedures would still generate inventory accumulation and, as a consequence, higher generated profits than the Buy & Hold. All that would be required would be to have prices fluctuate.

Something as general as the S&P500 is expected to be higher than today some 20 years from now might seem sufficient, but it is not even a requirement. The long-term average market trend for any 20 years rolling window for the past 2 centuries has seen a lot more ups than downs, by at least a factor of 9:1. But this is not an operational condition, the trading procedures would still do their jobs. However, I can easily see much higher performance levels with a higher S&P500 20 years from now; and even much higher levels due to increasing volatility measures.

When I look at Δ**P**_{?}, I see price variations of a probable portfolio composed of some 100 stocks spanning some 5,000 trading days of which I know almost nothing about. What I see is 500,000 decision points all at once needing an answer: buy, hold, sell, hold, and zero, which is also a trading decision. So my mission is to find ways to express those 500,000 decisions by designing an **H**_{?} to be applied over Δ**P**_{?} and produce an **H ^{+}**.

It is the design of these trading functions and procedures that are my main point of interest. How to control these imbalances in the face of uncertainty? How can one maximize generated profits without knowing where short-term prices might be going or how they will evolve in time?

Published ... May 21, 2012, © Guy R. Fleury. All rights reserved.