## Trading Stocks Generate Its Own Problems – Part V¶

Based on literature on designing stock trading strategies we should consider testing both an in-sample (IS) and an out-of-sample (OOS) trading interval before going live. Some even suggest another testing interval as an additional step after OOS to make sure that the trading strategy will not break down going forward.

But even that is not enough. As soon as a strategy will go live, its CAGR will start to decay. At the very least, trading strategies that are programmed to be linear will do so.

The following equation resumes the task to be done: $$\int_0^T \mathbf{H}_a \, d\mathbf{P} = \int_0^{n} \mathbf{H}_a \, d\mathbf{P} + \int_{n}^{n+\kappa} \mathbf{H}_a \, d\mathbf{P} + \int_{n+\kappa}^{n+\kappa+\psi} \mathbf{H}_a \, d\mathbf{P} + \int_{n+\kappa+\psi}^{n+\kappa+\psi+\phi} \mathbf{H}_a \, d\mathbf{P}$$where the total task has been divided into four phases: IS + OOS + Paper Trading + Live Trading. It starts with the IS interval with its stopping time $n$, is followed by the OOS interval up to $\kappa$. From $\kappa$ to $\psi$ you have the paper trading phase which still does not produce any real cash in the trading account. It is only from $n+\kappa+\psi$ that the trading strategy might go live. These are stopping times, numbers in the sequence of trades where you switch from one phase to next.

Every step of the way strategy $\mathbf{H}_a$ had to prove itself worthwhile. Yet, the market, at every step is evolving with periods of short uptrends and downtrends but still within a long-term upward bias.

That you base the stopping times on time intervals does not change the problem, it remains: $$\int_0^T \mathbf{H}_a \, d\mathbf{P} = \int_0^{t} \mathbf{H}_a \, d\mathbf{P} + \int_{t}^{t+\kappa} \mathbf{H}_a \, d\mathbf{P} + \int_{t+\kappa}^{t+\kappa+\psi} \mathbf{H}_a \, d\mathbf{P} + \int_{t+\kappa+\psi}^{t+\kappa+\psi+\phi} \mathbf{H}_a \, d\mathbf{P}$$where $\, t, \, \kappa, \, \psi,$ and $\phi\,$ are now time intervals.

There is only one phase that has importance, and it is the one that will be trading live (from $\,{n+\kappa+\psi}\,$ or $\,{t+\kappa+\psi}\,$ onward). All that preceeds is just to give you the confidence needed to apply the trading strategy live. The last trading interval should be the longest trading interval, if not the one to last for a very long time. Should it break down going forward, then all that preceeded it (IS, OOS, PT) was "technically" worthless and done for absolutely nothing at all. Even worse, you would have lost part if not all your initial trading capital as well.

This goes back to how do you detect and execute trades in such a manner that you fulfill your objectives when the only important part is the live trading phase?

We will ignore all the preliminary phases and concentrate on the live trading interval. $\int_{n+\kappa+\psi}^T \mathbf{H}_a \, d\mathbf{P} = m \cdot \bar z.\,$ and declare $m$ as the number of trades and $\bar z$ as the average profit per trade. This has the same meaning as when using $\, n \cdot \bar x \,$ in the general case.

Whatever the past, the live trading section will have its average profit per trade too. Its CAGR can be expressed as: $\, \displaystyle{ [\frac{F_0 + m \cdot \bar z}{F_0}]^{1/t}-1} = CAGR.\,$ Or, put another way: $\; m \cdot \bar z = F_0 \cdot ((1+CAGR)^t -1).$ The equation contains your initial stake, the achieved CAGR and time which are apparently the only things that matter. And it all translate to $\,m \cdot \bar z.$

Any combination of $\,m \cdot \bar z\,$ that can satisfy the last equation is a solution to the desired CAGR. You want 20\% CAGR for 20 years on \$1,000,000. Then, \$\,m \cdot \bar z = \37,337,600.\,$ We can immediately deduce that it will take more than one trade to get there, otherwise,$\,\bar z\,$alone will have to generate the$\$37,337,600$ profit.

Doing 1,000,000 trades with a net average profit of $\$37.34$per trade could do the job. That is 198.4 trades per day. Let's use 200 trades per day for further exploration. This would make the initial bets equal to$\$5,000$ each on which an average profit of 0.75% per trade would meet the objective. That is less than a 1% move per trade.

Any $\,m \cdot \bar z\,$ combination meeting the objective qualifies whatever the trading strategy used to achieve them. You want to do it with one trade per month, then you will need an average return per month per trade of 15.56%. Look at the behavior of your trading strategy, determine what makes it tick and then find ways to increase not only $\,m\,$ but $\,\bar z\,$ as well.

Here is an old chart that illustrates this: All points on the blue line have the same value: $n \cdot \bar x.$ You can scale it to the level you want. The curve will stay the same. Whatever type of strategy that reside on that line produces the same outcome, the same trading account balance.

It makes those two numbers ($\,n\,$ and $\,\bar x\,$) the most important ones of your trading strategy. It means that whatever your trading strategy does, it will end up with those two numbers. And therefore, all efforts should be extended to make them both as large as you can. The rest might just be window dressing, cosmetic code having no real impact on the final outcome.

You can get these two numbers using the "round_trips=True" option in your backtest analysis.