When you look at a tradable stock database all you see seems to make sense. You accept almost as if a matter of fact that the charts you are looking at should have evolved the way they did. It appears so evident that you can provide all kinds of explanations as to why the price moved that way. So, you say: this is an easy game, all I have to do is guess (determine, extrapolate, ...) where prices are going and voilà: easy money. You press enter on a keyboard, how hard can it get?

It gets complicated very fast.

The information available to a trader is tremendous. It is not just facts like fundamentals, annual reports, macroeconomics, but also all the background noise surrounding price variations: rumors, misinformation, tips, and opinions on all aspects of whatever might influence price movements for some reason or other. You have to add the millions and millions of participants with their own agendas and pet trading strategies going against computerized trading programs, HFT, frauds, and big money. What is a trader to do?

One could classify all available information in an information set (IS) which would include all the above and then add all one's known trading methods and strategies. The information set $IS$ could have any of the following, or any combination thereof, as well as anything else you might think of.

$IS \in \,\{Fundamentals,\, Indicators,$ $\, Machine\, Learning,\,Artificial\, Iintelligence,$ $\, Genetic\, Programming,\, Deep\, Learning,$ $\, Neural\, Nets,\, social\, media\, feeds,$ $\,advisors, \,newsletters, broadcasted\, opinions,$ $\,tipsters, \,prognosticators,\, \cdots \}.$

All possible trading strategies are also part of this information set: $\overset {\rightarrow \,\infty}{\underset{i}{H}}.\,$ As if giving anyone the ability to operate as if well informed. Most of it is information overload. No machine has ever been able to analyze all that data. As a trader, you will have to select and decide what is important to you, and what is less. Whatever you use, it will be a small fragment of $IS$. You will have to make trading decisions on partial data, uncertainty, and at times misleading information.

It is, however, this information set that can help control a trading strategy, and indirectly its payoff matrix: $\displaystyle \sum (H\,.^*{IS}\,.^* \Delta P)\,$. The information set will be responsible for making trading decisions. $H$ is the information surrogate; the holder of the output of all the decision making whatever it was for whatever reason.

$H$ is the thing to control. And $H$ can be anything, anything at all. What you want, as was said before, is the output: $\displaystyle \sum (H\,.^*{IS}\,.^* \Delta P)\,> 0$ as a bare minimum. You know you will have done good when the following will hold too: $\displaystyle \sum (H_{your}\,.^*{IS_{your}}\,.^* \Delta P)\,> \displaystyle \sum (H_{M}\,.^*\Delta P)\,$. Meaning that your trading strategy using your particular information set was sufficient to exceed market averages. You will have won. The rest is just a question of magnitude, and that can be somewhat controllable which I will try to demonstrate in this series of articles.

## A Tactical Exploration¶

Let's say we use a simple moving average crossover system for illustrative purposes. It is easy to backtest if such a system would be profitable or not. It won't be very difficult to design such a thing either, you will find coded examples all over the place which you could then modify to your liking.

A moving average has for equation: $SMA_t = \frac{1}{m}\displaystyle\sum_{k=0}^{m-1}p\,_{_{t-k}}\quad$ where $m$ is the lookback interval and $k$ its index. Your interest could be in a rising $SMA\,$ which can be expressed as: $SMA_t > SMA_{t-1}\,\,$ or more elaborately: $\displaystyle\frac{1}{m}\sum_{k=0}^{m-1}p\,_{_{t-k}}-\, \frac{1}{m}\displaystyle\sum_{k=0}^{m-1}p\,_{_{t-1-k}} > 0$. You might prefer looking at 2 moving averages convergence divergence $MACD$. It too has its equation.

## A MACD View¶

A trading system could use the $MACD$'s latest values at $\,t\,$ as trade triggering mechanism. $MACD_t = \displaystyle\frac{1}{m}\sum_{k=0}^{m-1}p\,_{_{t-k}}-\, \frac{1}{d}\displaystyle\sum_{k=0}^{d-1}p\,_{_{t-k}}$, $\,\,$ with $d$ the slower MA, being greater than $m$ the faster MA: $\,d > m$. Long positions could be held when $MACD_t > 0$, while shorts could be held when below zero: $MACD_t < 0$. The question is: is there a profitable trading system extractable from such trading procedures?

Another question would be: why take such an example in the first place? Has it not been demonstrated enough times that there is very little one can extract from such a system? The point I'd like to make is this: a trading methodology is the surrogate for trade execution which in turn structures the payoff matrix which in turn is the objective, the reason for doing all this. Whatever you use as trading strategy $H$ will operate under the same premises. It does not take away your main interest, and that is the output, the total and final payoff at termination time.

In a prior notebook, a stock's price history was broken down into two parts. A deterministic part: $\mu dt$, and a stochastic part: $\sigma dW$. The $MACD$ is an oscillator that measures the difference between two moving averages. Let's go with the basics and start with going long when the MACD crosses zero and stay long while ${MACD_t \geq 0}$. These periods are when the faster MA $\,m\,$ is over the slower one $\,d\,$. Note that a MACD crossing zero is the same as a two moving averages crossover system. And, we already know that over the long term those don't work so good.

A trading strategy was defined within a payoff matrix as $H$. Therefore, the following should hold too: $\displaystyle \sum _{i}^n (H_{(\mu dt + \sigma dW)_{macd \geq 0}} .^* \Delta P)\,$ giving $H$ its trade triggering mechanism and its inventory holding function. The inventory $h_{i,\,j}$ in each of the stocks $j$ will be positive when ever $MACD \geq 0$. This is not the same as saying that you are making money, it only says that you have some inventory while $MACD > 0$. The price at which it was negotiated is another matter, let alone if it was profitable or not.

It might not appear obvious but here is what will happen. On the $\mu dt$ side of the equation, one can only catch the drift. $\,\mu dt\,$, is a straight line. Therefore, while holding a position, on that part of the equation, you are entitled to: $\,\mu dt\,$, and nothing more.

What you will catch are all the line segments where $MACD$ was greater than zero: $MACD_t > 0$. You will be catching line segments knowing that $\mu dt$ has nothing more to offer. All you can do is catch the underlying trend, if it is there, and positive. With some experience you will realize that trading using $MACD$ is no guarantee of a profit. You might have a decision surrogate, but it actually lags the price action. Each moving average lags by half their respective lookback periods. If you take a decision based on a 100 day moving average, it is 50 trading days late. That is more than operating on yesterday's news...

Nonetheless, the strategy will profit from the drift part of the equation, and at most getting all of it if, and only if, you have total exposure, as in a Buy $\,\&$ Hold scenario.

The other part of the equation will create some problems, none relevant to the task of making profits. The part: $\,\sigma dW_{macd \geq 0}\,$ is a random process. The stochastic price equation was detrended. What remains is the error term which has for expectancy zero: $\mathbf{E}[\,\displaystyle \sum \sigma dW_{macd \geq 0}] \rightarrow 0$. The sum of the price variations attributed to the randomness of the price movements do tend to zero too: $\,\displaystyle \sum \Delta P \rightarrow 0\,$ for the random component of the equation. Which leads to only one conclusion: zero profits except by chance, by luck of the draw.

Thereby, having an expectancy to generate absolutely nothing profit wise in a long term portfolio. This is the same as saying that whatever is happening with the random component of the equation it will have a long term expectancy to generate no net profits at all.

A trader would be playing for the drift, and, just by having market exposure would get it.

## What Is A Trader To Do¶

That is the question. How should he/she behave under such a scenario? $\mu dt$ is a straight line, a least squares regression line. On a positive mean (meaning a stock with positive prospects), $\mu dt > 0$, the thing to do is buy, at any point on the line. As if saying: when is the best time to buy? Anytime, if you want to catch the drift. And, if you delay, you will get less.

But, and it is a serious one, even if your attempt is to buy $\mu dt$, in the short term the random like component of the equation $\sigma dW$ will be sufficiently large to bury $\mu dt$ to a point that it will be hard to detect due to all the ambient noise. However, your fundamental analysis can still say it is there buried under all that noise.

So, where do you make the money?

You know from the drift part, that you can enter a trade almost anytime, but still you have chosen to enter when the MACD crosses zero. You know you can't profit from the random component except if maybe while $MACD_t > 0$, you add the rule: $MACD_t - MACD_{t-1} < 0$. Thereby catching only the upswing of the move. Even if the price move is random, you will be catching part of the drift and part of the short term random variation.

Also, $MACD_t - MACD_{t-1} < 0\,$ serves the same purpose as a stop loss. In fact, it becomes the trailing stop loss for the trading strategy. You will not need to add another stop loss unless it can react prior to $MACD_t - MACD_{t-1} < 0$. If it is beyond that decision point, it will never be executed, and therefore, not needed. One could view it as redundant code.

You would get more not because you are predicting anything. But, simply taking advantage of price fluctuations. You don't even have to wait for the $MACD$ to make a top. You could choose to get out of the trade while it is still going up. Taking your cut. You won't win all the trades, but you will have designed a positive edge.

The image would be the same as the first chart in: http://alphapowertrading.com/index.php/papers/216-simple-stock-trading-strategy-iii which depicts quite well the action of a moving average crossover system. Just change the labels to moving averages, and you have a visual display of the stuff being said. It can be seen in that chart that the section of the curve above the exit price is a total waste of resources. So, is there grounds for improvements? Yes, definitely. That article already offered some design improvements.

## Going Further¶

From the above, you would win the game. Not only would you get $\mu dt$, but you would also get part of $\sigma dW$ simply due to your trading rules. You could go further and make your own requests. Instead of letting the market decide what is to be done, which is what a simple moving average crossover does. You can make your demands, you can take control.

Say you make the request that once in a position, you will sell when you get a 10% profit. You would be taking part of the $MACD$'s up curve. Here is what will happen. You enter a position as the $MACD$ crosses zero and then wait for the 10% profit. Having selected stocks that you think have future prospects, you should see that 10% profit on most of the trades. In fact, even if all trades might and will see some red, only the latest trade will be able to show red since all previous trades were closed with a profit. So, if the strategy makes 50 trades, you will have 49 trades, each recorded with a 10% profit, and 1 still opened position which could be at a loss or at a profit but below its 10% objective.

This says that you would have a loss ratio of $\displaystyle {1\over n}$ and a corresponding win ratio of $\displaystyle {{n - 1}\over n}$ or, $\displaystyle \frac {49}{50} = 98\%$. The last still opened position could be in the red. Or, if the last position in inventory is positive, your win rate would be 100% with no trade recording a loss. Note that the win rate increases as $n$ increases.

You might be dealing with probabilities, random-like price fluctuations, but you changed the rules of engagement. You are not following the market per say anymore, you just put your trading logic on the table, and that is what is governing the decision process and therefore it becomes your trading strategy: $\displaystyle \sum (H_{yours}\,^* \Delta P),\,$ your procedures. As a consequence of these trading rules, the strategy's total output will be greater than zero.

## Making Do¶

Such a trading strategy as described above does not need much, it could be done by hand, or using a spreadsheet. All it is telling you is that overall it will be positive, almost no matter what. Your task being only to monitor that the stocks you selected are worthwhile enough to remain in your portfolio. And each stock in your portfolio will show this simply by going up in price confirming the positive prospects you saw in those stocks.

The next question should be: will it be enough? Always the big questions. The answer: probably not, due to the lesser market exposure. But that can be improved upon. What is important, however, is that your trading procedure made the scenario positive and has made you win, has given you something that has the following property: $\displaystyle \sum (H_{your}\,.^*{IS_{your}}\,.^* \Delta P)\,\rightarrow \displaystyle \sum (H_{M}\,.^*\Delta P)\,$. Tending to achieve market averages is a lot more than $\rightarrow 0$.

After examination of such a trading scenario, you will observe the following. If you increase the profit target, you will tend to increase overall profits even if you are reducing the number of trades doing so. The logic is simple. One only need answer the question: how many z$\%$ moves are there over the period using the MACD thing?

What could be retained from such a strategy is: you can win. It is not the hard part and it can be on your terms. You only need to define what you want and make sure that the market can comply just as in the described strategy above. You will always be faced with: it is all up to you. Your trading strategy is composed of your choices and what you want your trading strategy to do. The market will just do its thing, you do yours. You backtest to see if your generalized procedures would have worked in the past to then apply them going forward.

When you put a mathematical equation to justify a trading methodology, you make a big statement, and it is supported by an equal sign.

I am not saying use the MACD as was described here. I think anyone could do much better. But it should give you ideas as to structuring your trading strategy so that the market meets your terms. There are equations, functions behind what you do trading. The math can help design not only better trading systems, but also provide a better understanding of what a trading strategy did, does and will do. Putting an equal sign on the table is more reassuring than just making a guess or having an opinion.

The MACD strategy above might not outperform market averages? But it will get close to market averages as shown above. The reasons why it will only tend to market averages are relatively simple.

1. The strategy suffers from underexposure. It does not utilize the whole upswing of the curve.
2. It is only linear. In the sense that you take one trade after another.
3. It gets in late (due to lag), and using a profit target, might get out early.
4. There are whipsaws, generating unnecessary trades.
5. A MACD entry is close to a random-like entry. There is no tangible benefit to having used a MACD entry.

## Conclusion¶

What I wanted to show is that even if we want to use some indicator to summarize price movements and try to extract trading rules from them it might not be enough. We have to intervene on our terms having set on paper our objectives. Knowing mathematically what will happen going forward because our trading strategy will have to continue to obey the math put on the table.

© 2016, October 12th. Guy R. Fleury