2
$\begingroup$

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:

  1. If my algorithm suggests I long stocks a, b and c, and suggests I short stocks d, e and f
  2. If my algorithm loses 50%
  3. 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?

$\endgroup$
  • 1
    $\begingroup$ If you consider fees, cost of time, etc, you can lose money with "short a, b and c" strategy or "long a, b, c". From my experience, when someone comes with the "inverse strategy" idea, it means that he/she doesn't have any idea what is doing. And there is nothing more dangerous than that. $\endgroup$ – nunodsousa Oct 27 '19 at 13:50
  • $\begingroup$ @nunodsousa the rate I'm losing funds seems to outstrip the fees. Thanks for the input though $\endgroup$ – user6916458 Oct 27 '19 at 13:52
  • $\begingroup$ Fees can play an important role in a strategy. A possible solution is to build a simple backtester to evaluate your strategy. Of course that a "real" backtester is quite complex since you have to be careful with matching, quoting, risk, etc. Nevertheless simple backtester solutions can give you some clue of what is happening. $\endgroup$ – nunodsousa Oct 27 '19 at 13:59
  • 3
    $\begingroup$ Even a good strategy can lose money if your unlucky. $\endgroup$ – Bob Jansen Oct 27 '19 at 14:07
  • $\begingroup$ Maybe just maybe there’s a lin-log problem here? It could happen that your portfolio has a positive arithmetic return but a negative log (compounded) return. In which case, the inverse short portfolio will also be loss-making when compounded. What is the arithmetic return (ie not counponded) and its volatility? $\endgroup$ – demully Oct 27 '19 at 20:35
3
$\begingroup$

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.

| improve this answer | |
$\endgroup$
1
$\begingroup$

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.

| improve this answer | |
$\endgroup$
1
$\begingroup$

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.

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Did you copy and paste your answer from another account? I think you should delete one of the accounts and just use one $\endgroup$ – Slade Nov 13 '19 at 21:37
  • $\begingroup$ @maus please merge your accounts. $\endgroup$ – Bob Jansen Nov 14 '19 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.