Why Reversing a Losing Trading Algorithm May Still Lose
Summary
The discussion addresses the intuition that reversing every long and short signal from a losing strategy should produce a winner. It explains why this does not follow: trading costs affect both directions, and a strategy’s rules for entering and exiting positions may not be symmetric. A stop-loss or other exit applied to a short position, for example, need not translate into an equivalent gain when the direction is flipped. Simply changing signal signs therefore does not guarantee that losses become profits.
One answer frames weak models as having little ability to distinguish future market states, so either the model or its inverse can behave like a random wager after costs. It also argues that historical profitability and cross-validation alone do not establish future predictive value. The responses offer different emphases, and the more formal discussion is conceptual rather than a demonstrated empirical result. The practical lesson is to examine the source of returns, transaction costs, exit logic, and out-of-sample predictive content instead of assuming that poor backtest performance contains a profitable inverse.
Key ideas
- Reversing long and short signals does not necessarily reverse a strategy’s realized profit and loss.
- Trading costs can make both a strategy and its inverse unprofitable.
- Entry and exit rules, including stop-losses, may behave differently after position direction is flipped.
- Backtest results and cross-validation do not by themselves prove that a model predicts future market states.
- Evaluate the strategy’s predictive basis and trading mechanics before interpreting losses as an inverse opportunity.
Tags
Full text
# Is a 'bad' trading algorithm useful?
# Is a 'bad' trading algorithm useful?
This has been bugging me for a while. I've tried to make a trading algorithm and they usually perform poorly; but here's the hitch:
- If my algorithm suggests I long stocks a, b and c, and suggests I short stocks d, e and f
- If my algorithm loses 50%
- Wouldn't an algorithm that shorts a, b and c and longs d, e and f make 50%
However, when I try and reverse my algorithms (so longs become shorts and shorts become longs) I still don't make money. Why?
## Answer by Dave Harris (score 3)
https://quant.stackexchange.com/a/49622
No, let me give you a technical reason why that probably will not be true.
Let us create two separate criteria to judge models by. The first is $\pi>0$ versus $\pi\le{0}$, where $\pi$ is the historical profit function. The second will be by the K-L divergence, where $\delta^*=\arg\min{\delta},$ and $\delta\in{D}$ is the set of possible K-L divergences from nature under a variety of algorithms $\mathcal{A}\in{A}$.
Because of trading costs, the probability that an algorithm $\mathcal{A}'$ or its additive inverse $-\mathcal{A}'$ will be ex-ante profitable will be less than fifty percent in the overwhelming majority of algorithms. No matter what you do, if you choose either algorithm, you will probably lose in the future.
Now let us consider the vast majority of algorithms such that $\delta'\gg\delta^*$. In that case, either $\mathcal{A}$ or $-\mathcal{A}$ will generally be profitable, ex-post, provided the diffusion process was large enough to cover the trading costs. We will ignore the small gains/losses cases for now because most traders would foolishly ignore them even if they were the best model in the future.
One note, the trading periodicity of the U.S. market based on spectral analysis is approximately 41 years. So a sample size of one is an algorithm tested over 41 years of trading. A sample size of two is 82 years.
Now, because $\delta'\gg\delta^*$ the profit function $\pi'$ will be weakly correlated ex ante to nature and the anticipated profit for both $\mathcal{A}$ or $-\mathcal{A}$ is negative.
Now let's consider the algorithm $\mathcal{A}^*$ such that $\delta=\delta^*$ and a strategy set $S^*\in\Sigma^*$ where each strategy chooses how to implement the algorithm in differing combinations of $\mathcal{A}(x)$ and $-\mathcal{A}(x)$ where $x\in\chi$ is the implementation of the algorithm on a security over a set of securities $\chi$.
Such an algorithm must exist or $\tilde{w}_x\le{R}\bar{w}_x+\epsilon_x$, where $\tilde{w}$ is the future wealth from investing in asset $x$ and $\bar{w}_x$ is current wealth.
In other words, there has to be a strategy to know how to invest or investing wouldn't exist.
When $\delta'\gg\delta^*$, then all algorithms and their additive inverses will behave like a roulette wheel. The trading costs imply losses will be the norm even if an algorithm has been backtested and been through cross-validation. There will exist a countably infinite number of bad algorithms if the asset set is long-run unbound.
As $\delta\to\delta^*$ the ability to discern an effective strategy, where some strategies are do nothing goes up. Berkshire Hathaway would be an example of a firm with a strategy that is close to $\delta^*$.
Profitability, ex-ante, is never dependent on back-testing or cross-validation. It depends on the distance from nature and its ability to discriminate states of nature over the asset class.
## Answer by Jamie (score 1)
https://quant.stackexchange.com/a/49389
Is this behaviour happening when back testing using the same data, or are you experiencing this when running your algo live? If back-testimg, then this will be due to fees. If live, then your algo behaving randomly and I expect your hypothesis underlying your algo is false.
## Answer by maus (score 1)
https://quant.stackexchange.com/a/49703
no, it will likely make also 50% loss. You have to also consider the criteria for closing the positions. They are not the same for closing the position having been a short or long. That is, a loss of 10% due to a stop-loss is not necessarily guaranteed to become a 10% win when the position's direction has changed (I think).
In other words, if you just could swap long and short positions in your trading algo in order to make it profitable, then you could find an endless number of profitable algos - just by finding one whose losses are greater than merely the fees (which should be easy). That applies to back-testing as well as to real trading. The answer of Harris seems not an answer to the question - it is clear that any model is only as good as it does predict the future. If the model fails, you loose.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.