July 18, 2021

The big word in the title is "automated". The process should start with your honed discretionary trading system using your trading rules, market know-how, and trade logic which you simply automated.

There is a lot of software out there to help you do that, not only simulate your strategy but also trade live. Why do it? Who would have guessed? Evidently, for the money. It is there, available any day of the week. Doing it right, getting close enough to your long-term goals should be more than enough and relatively easy to achieve.

Your "automated" strategy should be, technically, printing money directly to your trading account. A machine to do the job day in and day out. Depending on the trading strategy, it could even take you only a few minutes a day. "Automated" thereby becomes a word full of expectations. But, even if there are a lot of upsides, there are also many pitfalls to overcome. First, most people do not succeed at the task. Do not be one of them. Second, do your homework. Plan what your trading program will do, and teach it to do it the way you want it. Third, prove to yourself, using simulations, that your trading strategy is worth it and could last a long time.

If you do not test or simulate your discretionary trading strategy, how could you ever say that it can stand the test of time? If your trading methods are logical, it is simple, they are programmable. Your simulations are there to show your programmed discretionary trading methods worked and could continue working for some time.

With time, you might find it did not matter that much which trading methods you would have used in your automated stock trading strategy. As long as you got close to your expected long-term results and met your objectives, it should be acceptable. It is not about getting the highest score; it is about getting a high enough score. It is a game where you do not know what the highest score will be.

Not surprisingly, most discretionary traders have not even tested if their trading strategies could withstand the test of time. Yet, you should be required to accept their methods simply based on a selected example or two. To survive over the long term, you will need a lot more than that.

This article uses equations to make explicit portfolio statements. One such equation is ridiculously simple: F(t) = F_{0} + *X*, stating your future portfolio value is equal to what you started with plus all the cash you made over the entire trading interval. What needs to be evaluated is **E**[X], the expected outcome of your trading strategy. *X* does not stand for dark money but for the trading strategy's total net generated profits.

**The Whole Portfolio**

The profit or loss from a single trade can be expressed as: q ∙ Δp = *x*. Whereas, for tens of thousands of trades, simply add up all the single trades together: Ʃ_{i}^{T}(q* _{i}* ∙ Δ

_{i}p

_{i}) =

*X*where

*i*is the trade id number and counter, with

*X*the total portfolio profit or loss.

No matter how complex or simple your trading strategy might be, it will end up with only 2 numbers of interests. *X* = n ∙ x_{bar}, the number of trades taken *n,* and the average net profit per trade x_{bar}. It is easily obtained: *X* / n = x_{bar}.

Trading over the long term implies tens of thousands of trades, and therefore, the law of large numbers will come into play. The average net profit per trade will tend to a long-term constant: x_{bar}→ c. It will be up to you to use whatever trading methods you see fit to achieve c >> 0. Evidently, if c < 0, you lost and wasted your time and money.

*X* = n ∙ x_{bar} appears to be as if trade agnostic. Any taken trades, based on whatever reason, are accounted for. This should encourage you to use long-term averages to extract from price series what happens more often based on whatever criteria you find suitable for the task. You do not want x_{bar}tending to zero over the long term: x_{bar}→ 0. That is not good for your portfolio. It would nullify your endeavor, x_{bar}<= 0 should not be part of your expectations.

We can rewrite the expected portfolio equation as:

**E**[F(t)] = F_{0} + **E**[n ∙ x_{bar}]

To improve on the final outcome, over the same time interval, you will need to increase the number of trades *n*, the average net profit per trade x_{bar}, or both at the same time. And this, whatever you do trading. Any combination (*n*, x_{bar}) that satisfies X = n ∙ x_{bar}is admissible as an equivalent outcome.

This opens the door to any type of trading strategy whatsoever. Sure, a lot of those will fall short, especially those flawed designs based on non-consequential assumptions (discretionary trading strategies that would have failed over the long term). It is why you do simulations over past data in the first place to determine what your long-term expectations could be. At least to validate your trading methods and get a ballpark figure to strive for.

Any stock trading strategy will comply with the above equation. None will be able to escape the constraints of the equal sign. All the above is just common sense. If you do not see it, you are in serious trouble.

**The Payoff Matrix**

Another portfolio equation is an all-inclusive formula: the strategy's payoff matrix.

F(t) = F_{0} + Ʃ_{i}^{N}(**H** ∙ Δ**P**) = F_{0} + n ∙ x_{bar}

It simply puts in matrix format the previous vector formula: F(t) = F_{0} + Ʃ_{i}^{N}(q* _{i}* ∙ Δ

_{i}p

_{i}) = F

_{0}+

*X*. The formulas will stand no matter how large

*N*is. The payoff matrix format simply reorganized the data.

Generating large numbers of trades should be considered an easy task. While producing a worthwhile x_{bar}is something else. For instance, to generate 100,000+ trades, pick 100 stocks and rebalance daily. That single rebalance line of code over a 10-year period will do the job; you will get the 100,000^{+} trades. The problem is not there, it is in having an edge: x_{bar}> 0. See my last few articles dealing with these very aspects of the problem.

**Time - The Strategy Killer**

The above formulas are simply bean counters, needed, but again only bean counters. The stock market game has constraints. You have yours. One big constraint is time. You certainly will not achieve Mr. Buffett's results overnight; it took him over 50 years to get there. But that might not be your objective. You might simply want to build a worthwhile retirement fund that will give you all the freedom you want or think you need. Nonetheless, there too, it will not be overnight. You will have to put in the years.

A portfolio formula that considers time is: F(t) = F_{0} ∙(1 + g)^{t}, which shows the portfolio's growth rate. Evidently, the objective is to have *g* > 0 and *t* as high as can be to meet your objectives.

Over the long term, the stock market can offer about 10% compounded (including dividends). That is if you stay fully invested for 20+ years. Therefore, your expected outcome would be: F(t) = F_{0} ∙(1 + 0.10)^{20} = 6.73 ∙ F_{0}. Depending on your initial trading capital (F_{0}), 6.73 times might not be enough to motivate you to do all the work.

Mr. Buffett accomplished: F(t) = F_{0} ∙ (1 + 0.20)^{54} = 18,870.67 ∙F_{0}. If you had the market average over the same time interval, you would get: F(t) = F_{0} ∙ (1 + 0.10)^{54} = 171.87 ∙F_{0}. That is 109.79 times less than Mr. Buffett's achievement. As for time, it is 19,722 days or 13,608 trading days. Time you might not have.

The above formula has only 3 variables: F_{0}, *g*, and *t*. Two of which are under your control: F_{0} and *t*. As for *g*, well, you will have to work for it. You will have to earn it.

You could accept the secular market average r_{m} ≈ 10%, or put some effort into it and do better. Doing so will require some positive alpha as in: F(t) = F_{0} ∙ (1 + r_{m} + α)^{t} where g = r_{m} + α. In Mr. Buffett's case, his alpha was 10 points: F(t) = F_{0} ∙(1 + 0.10 + 0.10)^{54}. The real questions are: how high will your alpha be? And how long will it be applied to your trading strategy?

Another major consideration is what you will start with F_{0}. You want an outcome that is 10 times higher, simply increase F_{0} by 10 times. For some, it might be harder to get than they think, and for others, so easy. What is difficult is increasing *g*. You will not increase r_{m}, so your only alternative is your alpha (α). And that can only be generated by your trading strategy. Period.

As Jensen pointed out, in the late '60s, the average portfolio manager's alpha was about -1.7%. So, yes, you have your work cut out for you. And it is only by testing your long-term trading strategy that you will gain some insight into their possibilities. You are in charge of your own strategy designs. You make your program do what you want it to do. Then, do plan for your program to look forward and have its structure and trading logic designed to last.

**It's Your Retirement Fund**

You have your constraints, and the market is providing its own. You have to do the best you can whatever. For you, the stakes are high, it is your future, your well-being, so you should make as sure as possible you can reach your goals.

Time is the first commitment you have to make. Are you ready to last? Can you design a trading strategy that will survive as long? Can you manage to extract that alpha from all that market chaos?

The cited equations are fixing boundaries as to what can be done and what you can do. Regardless, whatever you do will comply with the bean-counting procedures. And that process is very simple. It is one, plus one, plus one more... It will take time to execute 100,000+ trades. They will not all be winners. But, you are looking for averages over the long term. You are looking for x_{bar}> 0.

Another consideration. Some think that reaching 65 is retirement time, even for their portfolio. A retirement fund does not necessarily stop at 65. It can have another 35 years to go. Just for the fun of it, say you start at 25 and let your portfolio run its course till you are 95, at Mr. Buffett's pace you would get: F(t) = F_{0} ∙(1 + 0.20)^{70} = 348,888.96 ∙ F_{0}. Here is a higher goal to reach, just adding 5 more points of alpha: F(t) = F_{0} ∙ (1 + 0.20 + 0.05)^{70} = 6,077,163.36 ∙ F_{0}. Along the way, you will be able to extract whatever amount you need for a better life, and you will have more than enough to do so.

In the end, you will find out that it was all choices you had to make. You decide now how much effort you want to put into reaching your goals.

It is not the start of the game that is important. It is the last few years of the journey. That is where it counts most since your portfolio is compounding. And compounding is a very powerful tool working to your benefit. Do take advantage of it.

**Related Articles:**

On The Use of a Rebalancer, a Flipper, and a Flusher

Making Money with no Fault of Your Own

Designing Successful Stock Trading Strategies

Winning The Automated Stock Trading Game

The In and Out Stock Trading Strategy

This article is also in HTML format:

**https://alphapowertrading.com/QC/automated_portfolio.html**

July 18, 2021, © Guy R. Fleury. All rights reserved.