April 27, 2013

Over the past few weeks, I've been posting in a LinkedIn forum on the subject of trends, randomness, and designing out-performing trading strategies. It started as an attempt to answer the question: "Cut your losers and let your winners run". What I wanted to show was this type of market wisdom is not necessarily true.

So, in about 15 minutes, I programmed a trading script designed to outperform while cutting potential profits (not letting profits run) and not using stop losses. Such an endeavor might be considered heresy by some but doing some simulations using the script should be sufficient to show the merits of this bit of market folklore.

Mind you, I am for stop losses. They have their place, but the point being made was not that. It most probably was that it was the strategy, the way the trading procedures and software routines behaved that might be more important than a nonsensical statement like buy low and sell high, which also has little value without strict definitions.

Here is a condensed version of the posts as they occurred:

April 12, 2013

Maybe, one might consider letting profits run to a certain degree. The following chart is the result of a small simulation (over the last 6 years) that had the objective of showing that a single-threaded trading strategy could indeed work fine.

IBM chart

(click to enlarge) 

Even if it took only some 15 minutes to code, it still provides a different outlook than just cutting losses short. It went as far as not using any at all. The simulation used only 1 entry technique and waited for a profit to exit a position. Not that many rules, one would say.

The strategy played patience. It waited for its profit. It didn't need much performance-wise and could reinvest its profits. It did not have to recoup realized losses; it did not have any. Because of the trading rules, all closed positions were profitable, resulting in a 100% win rate. Therefore, the trading strategy went from profit to profit. Wasn't that part of the purpose of the game in the first place?

Overall, the strategy did not use stop losses and technically limited its profits.

April 13, 2013

The above chart was first presented to show that a single-threaded trading strategy would work in response to someone who said it could not. I only put 15 minutes of coding on this thing, so don't expect it to be a universal answer to trading. Nonetheless, it still has remarkable properties.

The strategy was also a kind of contradiction to this thread's theme: "Cut your losers and let your winners run". Here, you have a strategy not using stops, limiting its profits, and still doing ok just because it played patience.

In a way, the strategy resembles a mini Buffett investment style mainly because it starts with a Buy & Hold attitude, if there is a profit, it will take it, and reinvest the proceeds. But it will still tend to accumulate shares for the long term. In fact, it does say: accumulate for the long term and trade over the accumulation process. Therefore, stock selection should be Buffett style, meaning for the long term. The strategy does not say to invest in Enron all the way down to bankruptcy. I do think some logic and some common sense should prevail here. But it does say maybe giving some leeway on some of your best long-term prospects might not be that bad an idea either.

Of the 190 trades, 165 were closed, all with a profit. On the last day, of the remaining 25 opened positions, if I remember correctly, only one was with a very small drawdown, the rest were profitable at various degrees and waiting patiently for their time to be picked and put in the realized profitable bin.

The strategy itself is a short-, mid-, and long-term player. It takes advantage of short-term price swings to add profits to the account, which can be reinvested for other swing trades or for the long haul. It's like pumping cash into the account at every price swing of significance. A look at the equity curve at the bottom of the chart shows a relatively stable curve.

It might not have taken long to code, but there is still quite a lot of finesse under the hood.

April 13, 2013 (cont'd)

To answer a question that the trading strategy required leverage to operate and that one should have some respect for the market, I replied:

The trading strategy presented traded IBM. It could only suffer IBM drawdowns, and since it had only part of its available cash invested, it might have suffered less variance than the stock itself (up or down). Also, IBM's beta is just 0.65. It moves less than the market itself.

An automated trading strategy has no notion of confidence. You do backtest to gain confidence in yourself and in the trading methodology to be used. So, overconfidence is not a killer. It is your objective; you want to be sure as much as possible that the trading strategy you want to implement is ok. I wouldn't go for partly confident. That is why I backtest so much. I'm really of the chicken type, and my methods reflect this.

The market has no respect for me, why should I have some respect for it. It is just a risk exchange mechanism. It doesn't care that I get in and for what reason, and it has the same attitude when I get out. I see no effect of my passage, no evidence, no trail, no footprint. The market is totally oblivious to my presence.

All I want is a trading strategy that, when applied, stands a better chance than most to be profitable over the long term.

The strategy presented could also elect to limit its profits too much, as can be seen in the following chart, where all its 188 trades were closed with a profit. 100% win rate. 100% profitable. Ending with 100% in cash.

BIIB chart

(click to enlarge) 

The above chart is probably saying that it's not a trading script that performed on only one stock and that maybe there are some interesting properties and side effects at work here.

April 13, 2013 (cont'd)

To show that maybe there are some interesting properties in the trading script, I added:

Some might think that trend following might be an illusion when far from an illusion, it can be the underlying motivation behind a trading strategy. After all, the game is not an overnight operation. It should be played for the long term. Or at least it should be viewed as if the player could last for the duration.

We are all looking for better trading strategies, and depending on our particular attention span, we are bound to design trading strategies that fit our short or long-term view of things which will correspond to our vision of the problem at hand.

There seems to always be someone, even without testing what they are saying, that will come out with: Oh, this does not apply. It's an exception; it will blow up long-term, and it's impossible to do better than average. When most of the time, it is just a matter of not being interested in a particular kind of strategy due to the fact that it is not the type of market that one plays or not the preferred trading interval or type of preferred asset under consideration.

I applied the strategy to 5 additional stocks in succession, only once and only five. Here are the results:

  No Stop Loss   
  PG chart CERN chart
  GILD chart MCO chart
  HD chart  

(click to enlarge) 

Any of the above could have been considered long-term candidates in an ordinary portfolio stock selection process some 6 years ago. The trading strategy used is minimalist (not many rules). It wants to have a short-mid-long term view of its trading environment. At times, it behaves as an investment strategy and, at times, as a purely trading method.

I would say that trend following is far from an illusion. It could be the real reason why a trading strategy outperforms.

If I did the same test on the 30 stocks of the DOW, I expect to obtain some similar results as those already presented with probably some stocks still waiting to achieve their higher potentials (meaning having still opened trades). But, I think that even doing a test like that will not be considered by some as any kind of evidence that a hybrid trading strategy can or could out-perform.

April 14, 2013

Someone on the LinkedIn forum expressed that he was not able to extract extra value from a Buy & Hold on FTSE stocks. To which I replied:

If you did not find evidence that you created value using your method does not mean that somebody else using "most probably" something quite different as a methodology is not generating some evidence of value creation.

To parallel your FTSE example, I had to do a test on the 30 DOW stocks, not just over the last 2 years, but over the last 6 years, which would include the whole financial crisis. I expected to obtain some similar results as those already presented, with most probably some stocks still waiting to achieve their higher potentials (meaning still having opened trades and still in the red).

The tested strategy does lack some basic protection as well as limits its profit potential. As I said before, it only took 15 minutes to code, and I do think that anyone could do better by improving on the underlying methodology, at least I know I can. I usually take weeks and months, not just minutes, to design trading strategies.

Before presenting the results of the DOW simulation, please understand that this is not what I would consider the best stock selection and that the strategy is not intended to be a universal trading strategy. But still, it should make its points. As a hybrid, it is an example to show that maybe looking at the problem from a different angle could or can lead to improved portfolio performance.

Here is the bottom half, the last 15 charts of the DOW. They are representative of the others and similar to those already presented:

  Dow Jones Example    

)click to enlarge)

Some stats:

Test duration: 6 years.
Number of trades: 5,963.
Number of winning trades: 5,548.
Winning trades: 93%.
Average trades per stock: 199.
Number of stocks still under water: 3.
Still losing trades: 7% (415 trades).
Total average aggregate portfolio return: 25.82% CAGR.

Note that many of the stocks limited their potential by having sold all their inventory prior to Friday's close (actually, 18 did, should say 20; one had 1, and the other 2 positions still opened). The still-losing trades should continue to improve over time. It should also be noted that in most of the above charts, most of the equity is in cash, if not totally in cash.

Designing a trading strategy to accumulate shares over time while trading over the accumulation process might indeed have for outcome value creation.

The strategy presented has all sorts of interesting side effects, or maybe I should call them features.

It's an end-of-day automated trading strategy issuing next-day market orders at the open; not the best way to trade, but you do what you can with what you have, especially at an early development stage (15 minutes of coding...).

When looking at the code, the trading procedures could just as well have been carried out using pen and paper. Naturally, in doing so, discipline might come into play. As a program, however, it is just that: a program, some code made to do something, and most probably more efficiently than doing it by hand, especially for a portfolio of 30 stocks or more.

It's the kind of strategy that could be run for the long term; at least, that is what the output indicates. Typically, the script first tries to accumulate shares for the long term (its Buy & Hold side), but will swing it if there is a profit (its trading side), and then will reinvest those proceeds for the long term or for another swing. The more the prices go up, the less the number of shares held, which will tend for the portfolio to be mostly in cash at tops. The more prices swing, the more trading there is, which tends to increase short-term profits. Basically, the program says: give me my profit, or else I'll wait for it.

Additional features like better protection (stops) should be nice. This can easily be added. More emphasis on the swing trades could be another interesting improvement; this would increase the number of profitable trades over the life of the portfolio and would have for direct effect to increase overall portfolio profits: Σ(H+.*ΔP). Increasing the accumulative process by improving or better controlling the accumulation functions would also tend to increase long-term profitability. All these added features would improve the bottom line further.

If a simulation does not produce a profit over past data, don't think for a minute that the future will adapt to a misconceived or badly designed script. At least simulating historical data will tell you if your code has something in it and if it has a chance going forward to generate value or not.

Even in its crude form, this seemingly misbehaved and uncontrolled trading strategy produced the charts and results already presented, and from that base, one could build and expand its features. In all simulations, you first want to see if a trading strategy can make some profit over time and at a desirable level: Σ(H+.*ΔP) > Capital ((1+r)t -1)

This is also a strategy that builds slowly, it acts as if like a cost averaging mechanism with a weak hold on shares purchased. For instance, it could serve with ease as a building block for a retirement account; or as a core function for a big fund looking for long-term profitability. It can be scaled to whatever level, up or down, and will maintain a long-term vision of things. Nonetheless, I would still first improve on the design according to the given guidelines. And most probably even add more features.

However you look at it, whatever the trading strategy, its profit basis is mostly the result of the application of common sense. I do not think in terms of indicators. I think in terms of occurrences. You have a profit (ΔP>0) on a trade. Then the next question is: how many of those can I detect, and most importantly, how many of those can I get? Apparently, quite a lot.

April 14, 2013 (cont'd)

To answer someone who said that the trading strategy was profiting from long-term plays, I wrote:

Your interpretation of the trading script I presented is way off. First, the charts show that profits originated mostly from the trading itself. Each successive price swing over each of the stock's trading history was used to pump in profits which could be used for the next swing. Because of the long-term vision, stops were greatly relaxed; like in this case, none were executed. But still, the system made its money on the trading. See the number of trades executed and the number of closed trades. Like in any system, there needs to be cash in the account to execute a trade. This means that at each price swing, there was a limit as to the number of trades admissible.

Also, the test did cover the whole financial crisis. Having a long-term vision, you take what you are dealt and try to make the most of it. The objective is that in time, positions are built in each of the stocks in order to profit also from the long-term trend, but notice that most of the charts presented ended with small or no positions at all. So even if the objective was to build and accumulate shares for the long term, the program preferred cash to expectations over the last or most recent upswing. This should be interpreted as the trading side of the script prevailed over the last trading cycle resulting in 2/3 of the 30 stocks having their total equity in cash.

Will this kind of method suffer drawdowns? Sure, any trading strategy will suffer drawdowns. The simple fact of participating in the market will generate drawdowns. Those not ready to realize that they will have drawdowns should look for other types of games, place only small bets, or put their money under their mattress.

Even Buffett, over his long career, has suffered drawdowns 4 times in excess of 50%. And since this game is a compounding returns game, this can have a major impact on profits: 50% up followed by 50% down in succession is not zero; it is – 25% (1.50x0.50).

If someone does not plan for his/her trading strategy to survive over the long term, how can that strategy survive? On my side, hoping for the best is not a solution. I prefer to simulate over sufficiently long trading intervals and on a sufficiently large number of stocks to show the worthiness and survival capabilities of my trading strategies.

The strategy presented is the lowest performer on this site. After all, it took only 15 minutes to code. I prefer more elaborate trading strategies, which include more sophisticated trading procedures and software routines aimed at accumulating shares for the long term (a subset of letting the profits run) while trading over the process; this way, pumping cash into the account that can be used to accumulate more shares and also trade more.

On Randomness of Price Series

I will have to do a separate article on this subject. Otherwise, this article would be too long.

So, stay tuned... and thanks for reading this far.

Created... April 27, 2013,   © Guy R. Fleury. All rights reserved.