Some of the stuff in portfolio management is so basic that we often forget how really basic it is. The building block of a portfolio is the position taken in some shares of a listed company as an investment or as a short-term speculative move. In both cases, the objective is to make a profit. We buy an asset and hold on to it, or resell it later on for a profit. Trading is simply doing the latter more often.

The problem is not with the understanding of the game, it comes from asking very basic questions, like what, when, and how much. An even more basic question is: why initiate that trade, at that time in the first place?

Portfolio management theory has had a lot of books written about it. However, few show how easy it can be to express the outcome of a large portfolio's total trading activity using a single mathematical expression.

I use a payoff matrix for simplicity and convenience. The outcome of a payoff matrix gives the total profit or loss of a stock trading strategy: Σ(H ∙ΔP). It is a simple expression and it carries a big punch.

My last article: Trading a Buy & Hold Strategy. A Game You Can Play might have had a better subtitle as A Game You Can Win. Was made a demonstration that a well planned long-term stock trading strategy can be designed to survive and thrive for years and years. I had my preferred strategy (DEVX8) do its third walk forward, this time for almost a year. See article for details.

Imagine, proposing to buy stocks in an upmarket. For over 6 years, my website has had a simple message: accumulate shares for the long-term and trade over the process. Using trading profits as a source of added capital to accumulate more shares. A kind of self-financing proposition. Over a dozen different stock trading strategies have demonstrated how it could be done.

You invest and trade in stocks not only to get richer but also to build up a retirement fund either, for yourself, your children or others, from which at some point in time you would want to extract cash for living expenses or whatever other purposes.

My last article (A Price Tag on Alpha - Part III), of a 3-part series, concluded with the realization that should one have a stock trading strategy that is generating some alpha, then he/she/they might be better off implementing it for themselves. Other benefits could be had. One I would like to address is the building of a retirement fund.

This 3-part series: A Price Tag on Alpha is trying to answer the question: What would people pay for performance of over 25% on a yearly basis? Part I covered the basics and Part II left some questions unanswered especially concerning the price one should pay for this 15% alpha.

A 15% alpha starts to be interesting if, and, I would say only if, F0 (the initial capital) is large enough, and that the trading strategy is designed to maintain its CAGR for years. If not, the strategy is not worth as much.

In A Price Tag on Alpha - Part I of this series, we barely covered alpha generation. All we did was put on the table an expression for the future value of the most expected portfolio outcome, this taken from the US stock market secular trend over durations of 20 and 30 years. We did provide a formula with the alpha considered but have not shown its long-term impact. Time to remedy that.

The other day, someone in a Quantopian forum, probably referring to his stock trading strategy, asked the question: What would people pay for performance of over 25% on a yearly basis?

The answer evidently should be a lot as this might put someone at the very top of the 0.1% of portfolio managers. For instance, to give this some perspective, Mr. Buffett has maintained a 20% CAGR over the years. And, look at what he achieved for his shareholders and himself. Maintaining a 25% CAGR (compounded annual growth rate) would be nothing less than most impressive.

After publishing my latest book: From Zero-Beta to Alpha Generation, Reshaping a Stock Trading Strategy, a few questioned the presented stock trading strategy as if it might be unrealistic. That we could not reach those kinds of numbers. When all this stock trading strategy did was follow the math of the game.

With everything provided in that book, I think anyone could rebuild something similar or better. The benefit: it would now be their own code. A strategy design they would understand well enough to maybe give them the confidence needed to apply it. Or find in it trading procedures that they could apply elsewhere.

It chronicles the remodeling phases of a stock trading strategy found on the web.

From its beginnings where it could not really outperform market averages to making it the most powerful trading strategy to have in a portfolio of strategies. So powerful, in fact, that over the long term, it could carry the day for the entire group.

Recently, I got interested in zero-beta stock trading strategies after reading on Quantopian's preference for such strategies. I always found them to be less productive profit-wise than other methods that would correlate more closely with the market. I got to dig deeper and had to change my mind.

One of Quantopian's forum members put out a zero-beta trading strategy that I found interesting as having some potential for me to modify and improve. It took a few tests to appreciate the trading logic conveyed by this strategy and see how it behaved over time.

It might be hiding in plain sight. In my last article: No Alpha No Game it was stated it was a sufficient condition to have an upward bias in the price data to win a long-term stock market game.

Often times, people want to look at the game as if randomly set, meaning that the probability of going up is about the same as going down. As if playing a heads or tails game. A game known, for centuries, to be a zero-sum game and unbeatable except by luck; when, in fact, the stock market game might be something quite different.

My latest book: A Quest for Stock ProfitsIf you want more, you will have to do more... mostly talked about an automated stock trading strategy that was described as gambling its way to the finish line over its 14.42-year journey.

Playing the stock market game has no rerun buttons. It also has no refunds. As a trader, you win, good, it is yours. You lose, well, you lost, next, please.

So, it would sound more than reasonable to make as sure as possible that over the long run you end up a winner. And, you can do this only with some alpha generation.

Obviously, to program until there are no bugs left. The important word: program, is just that, a program. An understanding of what you want to do is nonetheless required.

A software program that trades stocks live is playing with real money. It is as if it was not enough for you to lose money on your own, you had to program a machine to do it for you. A way of saying: there are prerequisites.

A Quest for Stock Profits describes a methodology that could be used by anyone. The same trading principles can apply going forward after having shown to have been reliable and profitable over an extended period of time.

I received the following short and direct question by email: "Is that algo for real? 40,000%?" It was referring to chart #11 in my last article: A Quest for Stock Profits – Part II

My reply was rather direct too:

Yes, and the trading procedures used are perfectly legitimate operations. They all survived within their coded limitations. There were no errors in the code, mathematical, logical or otherwise. No gimmick or deception. Just plain Python programming.

From what was presented in A Quest for Stock Profits – Part I, one might conclude that there was very little there of interest. Most of it almost ordinary. Nothing to make a fuss about. On the other hand, it might have been an appetizer, part one of a two-part series. There is definitely more to the story.

Over the last two weeks, I did some new tests using another trading strategy found on Quantopian. I only started modifying this strategy after someone made modifications to another version of the original program. The first time I looked at the original, I classified it as a throwaway. It could not even generate a speck of alpha.

A lot of time and work with nothing to show for it profit wise. It ended not even beating the index over its 13-year trading interval. At least, it finished close to it which is a lot better than most. But, nonetheless, not enough.

You often hear academics and traders say: "all trading strategies fail over time". They don't provide proof but will provide examples to make their point. And usually, for the examples they present, I agree, those strategies should fail. It is as if their selected trading strategies were designed to fail in the first place, and therefore, no one should be surprised if eventually, they do fail.

The stock market game is played under uncertainty. You are not totally certain of what the future may bring. However, if you take a long-term view of things, you could look for "stuff" that does make sense, and might most assuredly continue in the future.

I do expect, with a very high probability, that tomorrow there will be more people on the planet. I can not be certain on a day to day basis, but I do know I will be right almost every day of the year since it will require a huge disaster for that statement not to hold. And those "events" do not happen every day.

This is part of my post-test analysis of the last three articles I wrote (see list below). All the tests were done on Quantopian servers using their data under the same conditions as everyone else. I used a slightly modified version of the program found on their site.

The original cloned program used (The SPY who loved WVF) showed a 22.43% portfolio CAGR over its 6-year test. And this, while using 3x leveraged ETFs. If you did the math to convert the thing to a no leverage scenario, the CAGR would drop. There were no leveraging fees in this ETF scenario since leveraging is included by design. But, this still made it a 3x leveraged portfolio.

The previous article made the point that you could increase a stock portfolio's performance by slightly increasing a single variable. The given portfolio equation was:

A(t) = A(0) + (1+g)t ∙n∙u∙PT.

Based on this, in the previous test, g was raised by 1.5%. This time, it will be raised by 2.0%. And since g is part of a compounding factor, it should show its impact all over the strategy's timeline.

Once you have your trading strategy, meaning you have a long-term positive edge. There will remain one question. How can I do more of that?

Yet, my book states that one could do even better. One could start with a trading strategy having some built-in edge as was presented in Part one. And build from there. The portfolio equation to be used would still be:

A(t) = A(0) + (1+g)t ∙n∙u∙PT.

Raising g will increase the total output. You do not need to push by much since there is a compounding effect in place.

As a demonstration of the phenomenon, I used the same trading strategy as presented in the previous article. Raised its g value by 1.5%. A minor modification, yet, the impact is noteworthy.

The HTML file at the end of this article relates to my transformation of a cloned trading strategy as found on the Quantopian website. It was first declared as not worth pursuing. But I like to take such strategies and make them do more. A kind of demonstration of what you can find in my book holds.

The premise is simple. If the stuff presented in my book works. Then, almost as a foregone conclusion, based on those principles, I should be able to make such a trading strategy outperform. And the applied trading procedures would have a positive impact on the overall performance level. That is what this HTML file is all about. Making do with what was ordinary stuff, and making it great. You be the judge.

Building Your Stock Portfoliohas for sole purpose to help you make more money. It is about you building a long-term stock portfolio for whatever reason you might have, and making sure you reach your goals.

Is presented the making of a trading philosophy, a methodology which hopefully could become part of yours. My main objective is that you will not be copying what I do, but doing what will be right for you going forward.

In a previous article was put forward the notion of a trading strategy's signature. It was defined as the output of a long-term automated stock trading strategy that traded a lot. The result of a program which executed what it was programmed to do over an extensive period of time.

If a stock trading strategy is designed to generate thousands upon tens of thousands of trades, it will asymptotically approach a kind of law of large numbers. Meaning that the numbers in n∙u∙PT will become more representative of the whole due to the sheer size of n.

In my last article, A Stock Trading Strategy Signature, I presented a model for a trading strategy, an equation. It is derived from the payoff matrix, another expression used to resume a portfolio's entire trading activity over its lifetime. This model has interesting properties.

It too resumes, in just three numbers, the total outcome of any stock trading strategy:

Repeatedly applying an automated trading strategy to a bunch of stocks in a backtest will produce the same answer every time. It is the output of a program. A recipe, a set of trading rules, procedures, coded instructions and software routines.

Since the output of a trading strategy can be expressed as a time function: A(t) = A0 + n∙u∙PT, then, A0 + n∙u∙PT is its unique signature. Leaving us with 3 portfolio metrics of consequence.

People don't see how easy it could be to do more. If only they gave it more time. The ultimate objective is to outperform long-term averages, and making sure you do. So, here is a back to the basics.

You give yourself the job to go from point A to point B. Nobody is forcing you on this, that is to play this game. You already know your point A, that is where you are right now; with all your resources, know-how, and expertise. You know where you want to go. The only thing left is to determine the path to get there. And here Google Earth or a GPS won't help you.

My previous article (The WOW Factor) might appear at first glance as an exaggeration of some kind. For one thing, it is not a hoax or a data manipulation of some kind. It is just an aggressive trading program. It only needed deep pockets. The simulation was part of the development cycle where one tests for up and down limits. A lot of it is doable under more restrained methods. These added methods would have for sole purpose to reduce the strategy's volatility and drawdowns. They would still generate high returns, lower than what was shown, but still relatively quite high compared to market averages.

In my previous post, it was said I would not trade in that fashion. For one, I do not have that kind of capital available. And two, I may be too chicken. I prefer a smoother ride. But, that does not mean that this particular trading strategy is wrong, or that we can not extract useful trading procedures from it. Even downplayed the strategy could make quite an impact.

The strategy did give more than an indication of where upper trading limits might reside. And based on the strategy's code, it could do even more. I was exploring to find where these limits were, and even at the presented level, the program had not reached them yet.

I will start with the conclusion since it is intended to raise eyebrows and it can be given in one screenshot. The chart below comes from modifications to a program found in the Quantopian Lectures. To achieve such results, I modified the parts of the code that dealt with n, u and PT since they are the only portfolio metrics of significance. For more explanations on the portfolio payoff: n*u*PT, please refer to recent articles.

Usually, when changing an automated stock trading strategy, it implies making changes to the trade selection process and trading rules resulting in changes to a portfolio's trading history. But, each time doing this brings changes to trading procedures, and these changes tend more and more to over-fitting the data.

The very process intended to improve a trading strategy might be moving it further and further away from reality. Often, even making it less valuable. Some go as far as actually destroying any chance a strategy might have had of ending with a profit.

My last series of articles started with setting up the mathematical backdrop to a stock trading methodology made to last. Putting a stock portfolio payoff matrix at the center of it all as the bean counter for any trading strategy: A(t) = A(0) + Σ(H.*ΔP). This time function was then reduced to: A(t) = A(0) + n * u * PT.

Three numbers of interest: the number of trades done, the trading unit used, and average profit percent for trade. Three portfolio metrics that are given by any simulated or live stock trading strategy whatever its portfolio composition. One could view n * u * PT as a trading strategy's signature.

The previous article: Controlling a Stock Trading Strategy was to show you could control a trading strategy to do more than it had before by using mathematical functions that could impact its 3 most important portfolio metrics: n, u, and PT, namely the number of trades, the trading unit used, and the profit margin.

It was said in The Deviation X Strategy, that it was controllable. When saying something like that, I like to provide some kind of evidence that what was said holds.

The DEVX8 stock trading strategy has nine controls that can be viewed as sliders or knobs. Each having its purpose. Only six are shown on a chart (see chart #1 below: Control Setting, top left, second line).

For those that have followed this series of articles over the last two months starting with the Payoff Matrix, it is time to show how all of it can be applied in a trading strategy now that the mathematical background has been provided.

The last time I did a portfolio level simulation using the DEVX strategy was last November, not quite a year, but close enough. The one last shown was dated October, using a prior version (DEVX6 dated June 21, 2014) which was more aggressive.

In the previous 3 parts of this series was presented the output of any stock trading strategy using just 3 portfolio metrics: n*u*PT. The number of trades done, the bet size, and the profit margin, as if dealing with an inventory management problem. Only 3 numbers, two of which you can fix yourself, and the other, you can control to some extent.

In A Stock Trading System – Part I, and Part II have analyzed some of the workings of the 3 metrics: n*u*PT, which summed up a portfolio's trading history. Part II ended with a question. It was not: can more be done? But, will you do more?

Each stock trading strategy has its own "signature". It depends on the portfolio's stock composition and how trading is performed over time. In the end, at bean counting time, all you did trading will be explained by these 3 numbers: n*u*PT.

In my last article: A Tradable Plan – Part I, it was expressed that only 3 numbers, three portfolio metrics are sufficient to summarize all the trading activity and trading history of any stock portfolio over any duration.

Those numbers were: n, the number of trades, u, the trading unit used (bet size), and PT, the average percent profit per trade, profit margin, edge, or, whatever you might like to call it.

This new HTML file is another step in this series of articles. Refer to preceding articles starting with the Payoff Matrix to gain a better understanding of what is being put forward in this two-part installment.

Any automated stock trading strategy can be resumed by 3 of its performance metrics. Namely, the number of trades, average bet size, and net profit margin per trade (n, u, PT). Everything else is of lesser consequence, part of features, preferences, or descriptive properties.

This article shows what I consider the core of a trading strategy. Looks at the trading problem from a different angle than most. Starting from the end results metrics, then going back to design strategies that will affect these metrics over the entire trading interval. As if designing a strategy backward, but most certainly constructively, allowing for a multi-asset, multi-period view of the stock portfolio management problem.

The HTML file below starts to elaborate on trading methodology infrastructure. It is part of the background information needed to go forward. It uses a MACD trading strategy as an example to set mathematical structure to trading procedures. It could have used something else, the whole point is not on the MACD, but trading strategies in general.

The HTML file below tries to elaborate on the predictability, not of stock price movements, but mostly on portfolio performance outcomes. It tries to do this using only two numbers, one of which is just a trade counter.

The objective being to show that those two numbers which characterize a trading strategy can add some understanding of a strategy's long-term goals. As if giving the ability to make napkin estimates of where a portfolio might be some 20+ years down the line, thereby providing a reasonable guesstimate.

The HTML file below deals with the perception of trading decisions within the context of building a long-term stock portfolio. It is the continuation of a series of articles dealing with the underlying math behind a stock trading strategy.

Instead of looking for a trading strategy that tries to shift its portfolio weighs from period to period as in a Markowitz or Sharpe rebalancing scenario, the search is for long-term repeatable procedures that can affect a portfolio's payoff matrix over its entire multi-period multi-asset trading interval. The main interest is not in a trade here and there but on the possible thousands and thousands of trades over a portfolio's lifespan. All influenced by the trading functions put on the table.

What I see most often are stock trading strategies that operate on the premise of finding some kind of anomaly or pattern that the developer hopes will repeat in the future. He tries to select the best methods he has to do the job. But, it still is limiting in the sense that one is not looking to increase the number of trades but simply to accept the strategy's generated number of trades. As if looking only at one way to increase end results. It's okay, but one should want more and could do more.

The following article is part of a series. It deals with ways to enhance a stock trading strategy by incrementally increasing the number of trades to be executed over a long-term trading interval as well as increasing the average profit per trade. Thereby, giving a higher performance at the portfolio level.

This article examines stock trading strategies with structural defects. Meaning strategies designed to fail, even before they start trading. It is not because someone has designed a stock trading program that it will make money. You need more than that. One thing is sure, might as well learn not to include in your own programs trading procedures that are almost assured to obliterate your long-term portfolio performance. But then, anyone can design their trading strategies the way they want.

Designing trading programs implies mathematical formulas. We all have a vision of what our trading programs should do. Presented in this article, as in the prior one (Payoff Matrix) are building blocks for what I want to do with Quantopian. As if putting on paper, preparing an overall plan on how I want to use its facilities. The process could help others.

The HTML file listed below is full of matrix formulas. You don't need math to understand the message. For me, putting an equal sign on something is a big statement. All one can do after is declare: not equal, and show why. It is not a matter of opinion anymore, it is a matter of proof.

The file looks at the trading problem from a payoff matrix perspective, which in itself can represent any trading strategy whatsoever. It concludes with any trading strategy could also be expressed as the number of trades times the average profit per trade, leaving only two variables to consider when designing trading strategies.

The chart below is a simplified model of the SMRS where I've idealized market swings based on the setup premises in the trading program. The strategy's source code is available on the Quantopian platform and referenced at the start of Simple Stock Trading Strategy I. Further test results on some modifications to the program with their explanation can be found in Simple Stock Trading Strategy II.

Can a selection process of tradable stocks work in the future as it did in the past? We are always able to rank stuff, past data that is, since it is part of the information set available to us at the time. The objective is to find in the past data set something to activate decision surrogates to generate marketable trades in the future.

For one, I am looking for tools to help me answer the following graph:

Since I've returned to Quantopian, I've been busy getting reacquainted with their trading software. What follows are my first attempts at participating in their forums, even if I should have waited. But, the occasion presented itself. Anthony Garner, like many others, graciously posted his trading strategy results and code for all to see. It is the first strategy I looked at. I found it the easy way to review Python syntax as in learning by example.

In a previous article, it was argued that it was not enough to generate profits over the long term, but rather, that it was necessary to generate positive alpha. By this, meaning that whatever stock trading strategy you might want to use, it had to ultimately outperform the averages. Otherwise, an index fund would have been a better choice. In fact, it's more like any set of investments that could at least beat market averages over the long term would prove to be a better choice.

Over the past few days, I went back to the Quantopian website after some 3 years of absence to find that they had improved a lot, an impressive job, sufficient in fact to warrant not only a second look but enough to want to make it a strategy design platform. Sure, it will require that I re-familiarized myself with Python, its syntax, and packages, but I think it will be worth it. I do like what they did, and it shows promise for what I want to do.

A short-term stock trader has a choice, and that is to participate, take a position, or not. It is always his/her prerogative. Participating, taking action, is a deliberate act, that it be discretionarily done or delegated to a trading script.

A trading program will do what it is programmed to do, nothing else, and therefore, it is about the same as if its designer had made those same trading decisions except much faster, without hesitation or second-guessing.

An interesting recent article that appeared in MarketWatch had for introduction:

"Consider: The 30-year annualized return for the S&P 500 average was 10.35% through 2015, but the average investor in the U.S. market pocketed just 3.66%, according to an analysis of investors by researcher Dalbar Inc."

We read this, understand and accept the numbers, but we just pass on with some comment approaching: so what! We have seen this before. But rarely put numbers to it. $1,000 at 10.35% for 30 years give: $19,194. That's it!

Over the weekend I was confronted with the problem of stock trading strategy survivability as I was reading Prado's book on optimization of trading strategies. Since a lot of what you see in the financial literature puts emphasis on that most trading strategies fail, I had to show that at least my preferred strategy was not designed to do so.

Here is an aspect of trading that I have not seen often discussed in stock trading strategy design. It starts with the concept of line segmentation, or the slicing of stock price time series, and deals with what might be considered stochastic stopping times.

Most aspects of it have been covered before in financial literature, but maybe not in this fashion. Hoping to provide a slightly different perspective.

Should the picture change that much if I change the stock under the microscope?

I picked FDX from the same 10-stock list I often use in testing trading procedures. If a stock can pass my preliminary tests, then I can go further with the exploratory analysis.

It is when you change the stock under study that you can better view common elements. And from there maybe extract further trading rules designed to help at the portfolio level and not just apply to a single stock.

I opted to test the protective stop loss hypothesis starting with the notion of having a 10% trailing stop loss. The intention is to buy stocks on their way up and sell them later at higher prices (see the intro, part 1). To execute a trailing stop, you first need to buy some shares, so I also put in a 10% trailing buy order from a bottom.

What is it you want? The money, the entertainment, recognition, or maybe just something to talk about as if you were in the know of worldly events. Just in case it is the money, then you might appreciate what follows since it is all about your long-term portfolio protection.

This is a 3-part series that elaborates on the use of stop losses in stock trading strategies. I think you will be able to benefit from my observations. To skip the text, examine the charts for what they have to say.

Last month, after a week of designing on paper a trading system, I spent another three trying to formalize in code its trading procedures. At its core, I needed a special derivative function as I thought it might enable a different perspective on trading cycles. On paper, it showed a huge profit potential.

After reading the article: 180 years of market drawdowns, I thought I could add something to it. A different perspective, but nothing contradicting the author's point of view, on the contrary. I found his article most interesting.

Portfolio drawdowns are relative. They are relative to the trading strategy used. But one thing is sure, a lot of trades will see some drawdown, more than people think. I opted to use one of my programs to illustrate the point doing a simple test on two stocks I have tested before (see DEVX8 related programs). I just wanted to verify some numbers.

I somewhat disagreed with the initial appraisal. I did have a different take on it.

That thread initially implied that there is this 1% that made it (trading profitably that is) when even that was not demonstrated. The other 99%, were considered "rookies", from whatever profession they might have come from who had somehow to also learn the ropes somewhere.

After doing the long-term simulation described in my last article. It was time to open the black box and analyze what was inside. What follows is my analysis of the strategy presented in the previous article and I will reference it often. I want to extract what went wrong in that trading script to make it lose when without really trying it should easily have won the day, meaning that it could have ended positive, even if not by much.

Finding badly designed stock trading strategies is easy. I have hundreds of those on my machines. Took only a few minutes to locate one to illustrate my point. Didn't look at the code, technically, it was not required. But did perform a 20-year simulation on a small group of stocks. The same 10 stocks I used in recent months to explore a strategy's strengths, weaknesses, and limitations. The main reason for using that group was keeping the ability to compare strategies, and performance levels, while seeking the answer to the question: is strategy A better than strategy B?

There are millions of traders, millions of trading methods, but a lot more investors. At the end of the day, all financial assets are accounted for, to the penny, and in someone's hands. In the US, that's about $99 Trillion dollars worth; this includes real estate, stocks, and bonds. It's a big number. Some hold some of these assets for a short time, others up to multiple decades.

The short-term retail trader is part of the minority, doesn't control anything.

From the comments received over my last article on Randomness in Stock Prices, there appears to be some confusion for some in the terms used. I'll try to clarify my point of view.

Usually, the word random implies that you can not predict the next move better than by chance, otherwise it would not be random. You can assign odds, probabilities, to the outcome from observed statistics. For instance, in a random game like heads or tails, you can assign 0.50 as the probability of getting head on the next flip of a coin.

Will a game with 51:49 odds still show some randomness? YES, definitely, and a lot of it, even if it has a positive expected value. The same goes for a 52:48 game, there would still remain a lot of randomness. It might not matter much how the data might be distributed, it would still be mostly random-like.

Does the classification of a quasi-random game require a Gaussian distribution? NO, not at all. It could be any other type of distribution with or without fat tails.

The whole Strategy Experiment had two surprises. The first one being that the MACDv03 program managed to outperform one of my preferred strategy: DEVX8. The second, how unexpected it was since it was not my primary objective.

My objective was to show that you could take an ordinary trading script and transform it into a portfolio builder. I considered the task a worthwhile experiment, hence the title.

Time for some analysis. It took 2 days to design the first productive version of the program MACDv01. Another 3 to add the improvements that generated Strategy Experiment II (MACDv02). Made some minor improvements overnight which resulted in MACDv03, the one used in Strategy Experiment III, where I ran the program once on the 10-stock portfolio, and then reported the results.

In Strategy Experiment II, I presented a stock trading strategy based on the MACD, a technical indicator often used in developing strategies. In Trading Strategy Experiment I was shown that such a minimalistic based trading strategy would not produce much over the long term. However, in Strategy Experiment II, it was shown that it could be transformed and used to produce interesting results at the portfolio level, and over the long haul.

In my last article: A Stock Trading Strategy Experiment, I said it was time to do the portfolio level test. That I would take the same trading script, or slightly improved, that generated ABT's results and then use it on the other 9 candidates in the dataset. The same stock list as tested in Delayed Gratification. This way I would also be able to make some strategy comparisons.

The objective is to design an end-of-day (EOD) stock trading strategy almost from scratch with for background an old trading script that did no trading at all. It was published in 2000, over 15 years ago, author's handle: Glitch. As given by the author:

"The indicator oscillates around zero and registers extreme ratings when prices are trending. Values above 100 indicate a bullish trend, and less than -100 indicate bearish trending. This ChartScript colors the bullish bars blue and the bearish bars red. Congestion bars are black."

It's a major transformation for me. I usually put out stuff that is clearly free, with no strings attached. But then, you observe that because it is given free, people attached no value to it. So, maybe now they will think it is worth something.

A stock price series is the same for everyone. Everyone trading it wants to profit from it. Anyone wishing to trade it, implying short-term, understandably, will have some kind of method to do so. Trading one stock or instrument at a time might not be enough. One has to have some perspective, a long-term plan, not only to build up a portfolio but also on how to manage it over time.

The article Delayed Gratification presented the 20-year test results of running the trading script DEVX6 (last modified June 2014, over 16 months ago) to which was now added 4 lines of code made to insert a conditional one-day time delay before salable shares might be sold. This pushed the 10-stock portfolio performance higher by $226M compared to the previous version of the program, and this on a 12-week walk forward test where the market average declined by -3%.

In my previous article: A Case Study, commenting on the DEVX6 strategy, I said: "...those added lines ...could be used in the trading process itself since they were pretty good at isolating most of the trade clusters". It raised questions: why not use them? Can you get something extra using that information? Visually, those lines seem to be doing a decent job.

So, I went back to the DEVX6 program (June 2014 edition) and started looking at what I could do to improve the trading in general.

Over the last week or so, I've had some discussions on my trading methodology. One of which centered around a demonstration of what it could do. In reply to a friend's statement, I said: "my program would have done that too on that stock", which was to buy shares during the last price decline about a month and a half ago or so. I realized afterward that it was very easy to say.

Any stock trading strategy should be basic common sense. A stock portfolio does not grow instantaneously; it takes years to build it up and nurture. It is not enough to make a trade here in there without considering the size of the portfolio or the time span under which it will have to grow.

In building a stock portfolio, the account size alone will more likely dictate the trading/investment management style, its constraints, and conditions.

Also, it will depend on other things such as return objectives, acquired market knowledge, acceptable risks, available time, and temperament. I would say: "Ultimately, the portfolio manager will be the focal point, the only decision maker whatever approach one might want to use" be it automated or discretionary.

In my previous article: More DEVX V6 was shown a simulation of the program over 10 stocks over durations of 10 and 20 years. The point was to show that this particular stock trading strategy would easily survive not only over its first 10-year trading interval, but also over a 20 year period, and this including one year of walk forward.

One of the hardest parts of managing a stock portfolio is designing a workable and profitable long-term trading strategy. It needs to be based on sound principles and provide a foundation as to how it will handle an unknown future. Trading automation presents an added dimension to the problem.

There is sufficient data to start connecting the dots. What follows are explanations given to tests performed over the last few weeks to answer some questions on a LinkedIn forum. The last two tests have not been presented yet, but they will shortly. The point was to show that the trading method used mattered more than the stock selection that could be made.

A stock price series can be viewed as a stochastic, erratic, chaotic and random-like time function with shocks, gaps and fat tails. Mostly unpredictable. Accepting this has for direct consequence: one can't predict with any significant accuracy the price of any stock, be it today, tomorrow, next week, next year, or 20 years from now for that matter. Saying that a stock might be between $0.00, $10,000 or whatever with a 95% confidence level in some 20 years does not help at all.

Navinder Singh Sarao was caught cheating by spoofing. It took 5 years to finally prosecute him. 5 years during which time he continued to cheat. Could one say: regulatory agencies were sleeping at the wheel? For sure. Could one add that: brokers, exchanges and secondary parties that observed the misconduct were lending a blind eye since they could benefit indirectly by doing so?

When designing stock trading systems it is a good idea to view the problem, not only with a vision of what a trading program could or should do but also with an understanding of the environment in which this program will have to operate.

In a software trading program, which we can make it do whatever we want it to do, we only have logical decisions, calculations and statements in code to execute.

Whatever automated trading methods you might have used in the past, use now, or will use in the future, it has for unique purpose to make you money. It's not important that the code you use be well structured and nice or which software you will use. What's important however is the ultimate outcome of the trading strategy. One should understand what it really does and how it behaves under favorable and unfavorable conditions.

Recently, I made the remark somewhere that if my DEVX V6 random trading strategy simulation was performed again it would achieve almost the same results as the one done on November 2nd. It is always easy to make such a statement. But for me, when I express something like this, I need to show some proof or at least some evidence that it would be so. Expressing it, even if I know the end results before making such a test, it might not be considered sufficient by others.

In my last paper: A Donor Within, it is explained how an existing trading strategy was modified to reach a higher performance level. The section: One More Thing, starting on page 30, goes through the process.

First, the desired expectations were put on paper before any testing: increase position size by a factor of 10, and then improve on the compounded annual growth rate (CAGR) for the 30 stock portfolio over the last 25 years. Needed software procedures were determined, then the program modified and debugged on a single stock.

Just sent my pledge to the Bill & Melinda Gates Foundation. I found it to be the best outcome for my years of research. Over the last few years, I've developed a series of better and improved trading strategies. My best strategies should be considered sophisticated, designed for long-term appreciation, and should prove to be most profitable.

I view the offering of my best performing trading strategies as my way to help people, more than I ever could alone. It is all explained in my latest paper: A Donor Within.

As a follow-up to Winning by Default, I wanted to show intermediary test results. The objective being to show the evolution of such a trading strategy from day one. There was no need to enhance its performance level beyond the rudimentary settings as was done in Winning by Default. This is more a what-if scenario analyzing a trading strategy's long-term behavior and system metrics.

Scenario: from one stock, over an 8 month period of the past year; I predetermined trade entry and exit points by date. Therefore, this experiment is entirely fabricated. Nonetheless, there was something to learn from the process.

Using one stock (AXP), I hardcoded trade dates and produced the following for summary performance report:

In the same vein as in previous articles, I'd like to present the following charts from a portfolio simulation done over last weekend. It's huge and I am still analyzing the details involved in such a big portfolio. Its payoff matrix has for size: 13,000 rows (days) by 985 columns (stocks); that's 12,805,000 data entries for each of the matrices involved.

As a summary, up to now, 4 long-term trading strategies have been analyzed. All four started as nonproductive, meaning that they could not even beat the Buy & Hold over the long term (read 20+ years). The trading strategies original versions have been in public view on the legacy Wealth-Lab site from 8 to 12 years. Each strategy was modified to gain a long-term perspective with for backdrop the accumulation of shares.

Following my previous note, there was only one thing left to do and that was to perform all the mentioned long-term tests. First, on the original program version as published on Wealth-Lab in July 2002. Then on one of my modified version of this trading script DEVX (version 3) and leave for the end improvements that could push performance results higher using general trading policies rather than trying to optimize parameters.

My next trading strategy to be analyzed is kind of another strange trading script, it buys and sells on about every price swing. It sets a no-trade zone. Will buy below and sell above. Yet all entries are the result of random functions. It gives the illusion of perfect timing, when in fact, trades are coincidental, meaning not hitting the highs and the lows on purpose, but as a side effect and direct consequence of the methodology used.

Still in the process of re-evaluating my old trading strategies. This time the selected strategy is the BBB System (BullPower and BearPower Balance). It was designed in 2003 and its author also published it in Stocks & Commodities magazine (October issue). This means at least 10 years of out of sample (OOS) data. One can do a 10-year walk forward test on this one since it has been literally frozen in time.

About a week or so ago I started doing the inventory of my trading strategies, a project that has been delayed for over a year due mostly to procrastination and lack of time. It's a big project. I'll have to go through over 200 trading strategies of mine and document what each trading procedure does. Then determine their relative importance and the reasons why they contributed to overall performance. Hopefully, this should translate into designing even better trading scripts or at least selecting the best of the crop.

In my previous note, I presented a chart displaying the evolution of the stochastic differential equation SDE based on the length of the trading interval Δt (from Δt → 0 to Δt → T (long-term horizon). The SDE is an idealized and acceptable model to depict price action and has been widely documented in academic papers for over 60 years. It's a simple regression line over the considered data.

This article starts with the conclusion of a few lines drawn on a piece of paper, a simple representation of what I had in mind. I knew that the two drawn sigmoids were the answer to what I wanted to express. It's not that it was saying anything new, these curves have been out there for ages, it's just that much information could be extracted from those 2 curves.

This is a follow-up to my previous article on leveraging, where additional explanations were required to make my point clear. The formula presented lets one "control" an acceptable leveraging factor without changing much to the long-term output (as a matter of fact, less than 1%). And even there it will be to one's advantage.

Last weekend I had to answer a question: < I have read all your posts but I am little unclear about the following where you said: " it does show the value of accumulating shares of a rising stock and letting the market pay for it. " >.

My answer might be of interest to some. I thought the easiest way to answer this question was to illustrate the point with a few charts.

In Designing a Trading Machine V, and previous notes in this series, the point was made, hopefully, that accumulating shares over the long term while trading profitably over the process was another way of looking for some kind of trading edge. This edge had for vision: nΔP, with ΔP > T > 0; producing on average, a positive difference ΔP, a trade profit threshold T to be reached, and which was desirable to repeat many times (n), or else go for a larger ΔP on a small number of trades.

Everyone seems to agree with the notion and existence of a "trend", but no one seems to agree on its definition. Some want a universal definition with no compromise; like in, this is "the" trend, period. Geez, it's evident, see, it starts here and stops there; it can plainly be seen by anyone of age on any chart of past stock price data whatever the selected time frame.

The prior two sections: A Basic View and A Basic View II were simply a necessary introduction, just as this part is, to the reasoning needed to look at the trading/investing problem from the perspective of portfolio optimization under long-term uncertainty.

When considering thegraphic presentedin the previous section, one soon realizes that it is stating the obvious: we know the past to the penny, we know the now for what it is, and the future remains almost a complete unknown.

When looking for a trading strategy, one usually starts with a search for methods and indicators that can identify trends, then proceeds to find triggers as decision surrogates to execute entries and exits. Looking at past stock data, trends of all lengths can be found with ease even if one does not have a clear, precise or universal definition of what a trend is.

However you want to look at your trading methods, some very basic math applies. For sure... It is not, and cannot be: those math things don't apply to me, I've got "my proprietary trading system" of play that circumvents all that. Sure...

Some seem to look at the stock market game as if the same as a casino and play accordingly.

Optimization of a stock trading script over past data is the process of finding optimum procedures and parameter value sets which can produce the highest possible return over the testing interval. Robustness could be said of a system having wide ranges of values for each of the parameters in the set and still maintain high-performance levels.

As a follow-up to my previous article on the long-term simulated IBM performance results, I've opted to provide more details on the origin and make-up of the underlying trading strategy. That article concluded with the results of a prior simulation done almost 2 years ago in July 2011 using almost the same trading script.

Last week, while I was looking for some software routines, I started trying out some of my old programs to see if visually it would be easier to locate them. These programs had not been executed for over two years, and out of curiosity I also wondered how they would have done. It would be like a walk forward test and an out-of-sample test at the same time since none of the data could possibly have been known to these programs outside their initial testing intervals.

When looking at stock price series, you often hear that such series are random or almost random in nature and if such was the case, then such series would have little predictability if any. However, some interesting observations could be made depending on the model used to mimic random stock prices.

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.

From the observations made in Designing a Trading Machine IV, it was said to find and select some n (ΔP > T) on a daily basis (or any trading interval for that matter) where n was the number of profitable trades exceeding a certain threshold T.

In Designing a Trading Machine III, I was making the point that ΔP > 0 was a sufficient condition to make a profit: P(out) – P(in) > 0. It says nothing about how the profit is made, but it does say that to have one, the relation must hold. This relation could be considered time and size independent.

Designing a Trading Machine II ended with the presentation of a simulation test where the objective was to increase the number of profitable trades over the trading interval. The selected script was transformed in order to increase its buying procedures and thereby increase its number of trades (some 40-fold over the original) for the 6 years trading interval.

Following the previous article: Designing a Trading Machine, it's time to start designing it. Some considerations or constraints will first be addressed, and from there start to give a structure to a trading strategy that will or should survive over the years.

Since the design is to be automated, some trading functions will be needed to explain not only the intention but also the overall expected outcome.

I participate in a LinkedIn forum on automated trading strategies, here are some my observations over the past few days, starting with March 11th.

This forum is about automated trading strategies, and yet a lot of posts are on discretionary trading methods which by definition are not automated. In fact, if your trading method is not programmable, it is discretionary. And thereby cannot be systematically backtested. Otherwise, going full circle, it would be amenable to code.

In my previous note:An Experiment, I chronicled the process of modifying the Livermore Market Key trading script after having issued a challenge to anyone wishing to show their system development skills. What follows is the continuation of that article starting with its ending.

In early June 2011, I had this great idea: take a known and publicly available trading strategy; offer a challenge to improve its performance level using whatever enhancements one could bring to the task. I figured it would be a simple way to showcase my own trading philosophy; if it was any good, it would easily show in the test results.

To make the concepts in my trading methodology clearer and mainly to answer some recent criticism concerning the mathematical expressions used in my notes, short of maybe giving my programs away, I opted to revisit the foundations on which my methods rest and explain them in more detail.

How can I win the stock market game? One asks this simple question and is bound to receive a million answers. Almost everyone has a piece of advice on this subject with lots of investment folklore, hot tips, and unsubstantiated claims.

I have had this web page up for over 15 months now. Its prior version has been on since 2008, and during all this time I have promoted the concept of trading over a stock accumulation process as a methodology that has more than the potential to out-perform most trading methods out there.

I occasionally participate in the Automated Trading Strategies forum on LinkedIn. And over the past few weeks, I provided some comments which elaborate on the trading methods I use in my strategy design. The following observations are almost in chronological order.

Designing a very profitable trading system is all about compounding. And if there is one thing that any trading method should strive for is to acquire, as much as possible, long-term sustainable alpha points. Playing for a 40% return in one year has little value if it is lost the year after ($1.00 x 1.40 x (1 - 0.40) = $0.84).

My latest paper: A Changing Game is out. It summarizes some of my latest articles on random trading over randomly generated stock prices made to mimic real stock prices including rare events or infrequent price gaps. An Excel file is provided for the more venturous. It contains a lot of lessons for those that want to look beyond what is there.

The stock market game is a compounding rate of return game. The main objective is to obtain a compounded annual rate of return as high as possible over the longest time interval within portfolio constraints of which the first is not to go bankrupt.

In one of its simplest forms, portfolio performance could be expressed as:

After the conclusion of my previous note: Changing the Game II, it was time to put the finishing touches on the Excel file.

This file is a working model designed to showcase some basic trading principles and methodology. It is not an end-all, but it does show that accumulating shares and trading over this accumulative process can generate profits even if the entries and exits are taken at random.

In the previous chapter: Changing the Game, it was presented that even trading randomly over randomly generated stock prices could not only generate a positive outcome to the portfolio payoff matrix but that this outcome could generate exponential growth.

In my last commentary: Randomly Trading, I presented the execution of a randomly generated trading strategy over randomly generated stock prices. The original intent was to answer someone on a LinkedIn forum on how to build a payoff matrix: Σ(H.*ΔP). So model 1 (very basic Excel file) was provided to show how to set up all 4 of the needed matrices: P, ΔP, H, and H.*ΔP. Each matrix dealing with an aspect of the payoff matrix used to simulate a portfolio of 10 stocks over 250 trading days (about a 1-year trading interval).

After dumping the Ichimoku script and starting to transform a Bollinger Band trading system found on the old Wealth-Lab 4 website, it was obvious that this new system had more potential. At least, it could keep part of its identity.

It turned out that this “new” 2008 system was a variation of a 2002 Bollinger Band system designed by Mark Brown participating in one of the forums I visit on LinkedIn. At times, the world may be very small.

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.

Usually, developers start by programming trading strategies based on some particular idea or concept they might have on market or price behavior. The objective is simply to design a better trading strategy. They will backtest over past market data to see if the trading procedures do generate profits or not. And from there will start an iterative process to improve the structural design of their new preferred trading strategy.

Over the past few months, I've been mostly involved in backtesting various concepts to see if they could enhance my trading methodology. The process is still on-going. But meanwhile, I thought it might be interesting to respond to a post on the LinkedIn group: Automated Treading Strategies, where the question was: why not show your methods live on Covestor or Collective2? This way anyone would see your so-called “over”-performance results, and if your trading methods have any value.

All I have written on this website is dedicated to a single equation which translates a single concept. This equation has evolved over the years but not in what it represents or its governing trading philosophy. The concept remained the same throughout: trade over a long-term share accumulation program. And in its latest iteration, serving as an explanation for the process, its payoff matrix representation looks like this:

Recently, in a LinkedIn forum, I presented my latest research note: Optimal Portfolio V. The object was to show that designing holding functions that can increase exponentially in time had for secondary effect to increase portfolio profitability at an exponential rate as well. Using a stock accumulative process to which was added a trading component could produce exponential alpha that went way beyond the Buy & Hold strategy.

Recently doing some tests on some scripts that are still available on the old Wealth-Lab 4 website, I noticed that I could select almost any script and push its performance level higher. And that raised the question: why? You should not be able to do this. All scripts are like trading philosophies, a modus operandi, a kind of recipe trying to print money. These trading strategies are not just some set of random buy and sell orders.

Programming trading strategies is a succession of transforming an idea or ideas into procedures that when applied performs better than the previous iterations.

I am always looking for the best performer. I also know that I can always do better. But there are some basics. First, I know that whatever effort I deploy I must at least beat the long-term Buy & Hold strategy. If I can not do that, then why do all the work?

In my previous notes, I tried to make the case that by adopting administrative procedures, a portfolio manager could achieve an exponential Jensen ratio. All he/she had to do was to re-invest the portfolio's profits as they came in. Not that difficult a task! About the same as re-investing the dividends as they came in. Nothing fancy, I would even say boring, but a task that needs to be done nonetheless.

I tried to show in my previous article that by adopting a profit re-investment policy it was not only possible but a simple way to achieve an exponential Jensen ratio. The conclusion was that skill matters, and it grows with age. It's part of the very nature of an exponential time function. So the question becomes: why aren't most investors adopting such a winning strategy? Or better yet: are there ways to improve on this exponential Jensen ratio?

Academic financial literature is fond of the notion of No Free Lunch (NFL); which is the same as saying you can not do better than us. If there was a free lunch, we would have eaten it already. There might be some crumbs left but then again...

Since last April, I have done numerous trading simulations looking for which of several trading methods I would like to adopt. Its a search not only for the best performer but also for the one I'll be most comfortable with; and which would become my trading platform for the coming years.

This article is dedicated to Ian who asked very pertinent questions concerning my trading methods on LinkedIn's forum: Automated Trading Strategies. But I did not have simple answers. I was aiming for a short reply, but it morphed almost into almost a thesis. I am sure he will recognize from the maze below answers to his questions.

My back-testing methods usually start the same. I locate a script for one reason or other, try it on a few stocks, then look at the script to explain what I saw on the generated charts and analyze the trading decision making.

In this case, I started yesterday with the: “One Minute Bollinger Band System” chartscript listed on the old Wealth-Lab 4 website. This script is presented as Technique 16 in the book: “Trade Like a Hedge Fund”. (Note: The Wealth-Lab 4 website has been shut down).

First, a Side Note:

All my writing is to show that by slightly changing one’s point of view, one can design automated trading systems that not only outperform the Buy & Hold but will leave it far behind performance wise. The first point being made is probably that the Buy & Hold and short to mid-term trading are not mutually exclusive; combined they can do wonders.

For the short term trader, trading on what basis becomes a major concern. Fundamental data is of little help analyzing short-term market activity. Technical data is good at saying what was, but has little short-term predictive powers. Statistics seems to become the only source of filtered data that can bring an edge, but there again, all you will find will describe past price action.

Not everyone needs to do back-testing and therefore to some, it is not a worthwhile endeavor. There are thousands of ways to play the stock market game and a lot of them do not require back-testing at all.

For instance, I am sure Mr. Buffett does not do any kind of back-testing nor does his staff has any time for it.

I have been in the implementation phase for over 6 months now. A lot of backtesting has been done; always improving on the trading model and pushing performance higher and higher. From the first implementation where the compounded annual growth rate (CAGR) was around 50% to the latest iterations where the CAGR exceeds 100%, it has been a long journey.

This site is dedicated to a single concept and that is: it is not only possible to beat the Buy & Hold strategy; it can be done easily and by a wide margin. Doing so requires changing slightly the point of view of the stock trading process and is summarized in the graphic below:

I am always looking for reasonable explanations for my trading scripts. What makes them work, what are the principles at play, and what is the main reason for their high or low performance? Are the improvements really real, operate at the portfolio level, or are they just curve-fitting on a single stock? These are all legitimate questions and if I can’t provide a reasonable answer, a common sense answer, then it should be back to the drawing board.

What is Alpha Power? Alpha Power is a trading methodology developed and refined over the years to become a total portfolio management solution. It was designed to meet several key objectives: 1- to greatly outperform the Buy & Hold strategy, 2- to accumulate shares over time while doing so, 3- to trade market swings over its accumulative functions, 4- to accept other features that can boost performance.

Implementation Phase. At Last! Over three and a half years in the making; always sidetracked by the need to prove to myself that the methods that were used were worthwhile by setting the mathematical framework where they would have to survive. Had I not achieved to demonstrate mathematically that it was feasible to achieve some alpha trading stocks, I would have had to stop searching.

This article is a follow-up to the position sizing article. It is available HERE.

What preceded on position sizing was the general mathematical framework where an optimal trading strategy was simply summarized as a share-holding matrix:, where the initial quantity held in inventory could grow at the portfolio's delayed average exponential rateThis "optimal" trading strategy is not unique; it depends on each stock's appreciation rate and as such will be different for each subset of stocks selected as a portfolio.

My lastest trading formula. Over the past few weeks, I have been working on ways to mathematically express some of the performance behavior of my underlying trading philosophy in an attempt to better understand the whole process. My trading methodology uses partial excess equity build-up to acquire more shares on the way up and consequently slightly leverages the portfolio. See my Jensen Modified Sharpepaper for a more elaborate exposé.

Before proceeding with this next section, I would like to make a few comments. This is not intended for commercial publication; for me, it is just a way of keeping a public record of what I think has an intrinsic value (the formula for the Jensen modified Sharpe ratio - equation (16) in my first paper). I write first for myself and sequentially, meaning from the top down and when I miss something or other will go back to include what, I think, is missing to make the current passage more understandable.

I wanted to set one of the controls settings, described in my Jensen Modified Sharpe paper, to the desired profit level. From the paper, it is said that you can preset the sum of profits generated. It is not said that you will reach them. The governing equation is dependant on the size and nature of the price fluctuations and that cannot be guaranteed.