Everyone knows it by now. On April 20, 2020, we experienced negative oil prices for the first time in history.

Or did we?

First, let’s review. A barrel of crude oil is, well, 42 gallons of sticky, stinky, black stuff.

A futures contract, on the other hand, is a contract between two parties obligating one of the parties to sell and the other party to buy a specified quantity of a specified item on some date in the future. The buy/sell transaction takes place subject to certain delivery procedures specified in the contract.

If someone enters into a futures contract but doesn’t want to go through with the buy/sell transaction, that person can *offset* his position by entering into another futures contract on the opposite side. There is a *clearing house* that keeps track of all this stuff, and if you have both an obligation to buy and an obligation to sell, the clearing house simply wipes it off the board and you’re good.

A futures contract has an *expiration date.* If you’ve entered into a futures contract and haven’t offset it by the expiration date, you are obligated to execute the buy/sell transaction.

The details of how futures contracts are priced and how P&L is calculated is largely unimportant to this discussion, except for the following. First, many futures contracts have daily price limits, which limit the range of prices at which transactions can occur during a given day. If there are no buyers above these limits or no sellers below these limits, trading ceases until buyers or sellers come into the market or until the next day. These limits are generally removed as the moment of expiration draws near. Second, at the moment the futures contract expires, the futures contract price and the price of the physical item should converge.

So, did “crude oil prices go negative” on April 20? I doubt it. Let’s ask the question this way: Was there any place in this country where I could have backed up my pickup truck or tanker car or hooked up my pipeline and said, “Load her up, boys, I’ll take all you’ve got and you can pay me for the trouble!” I’m not a physical oil trader and definitely not an expert on the physical oil market, but if there was any place in the US where I could have been paid for taking away some oil, please educate me.

There were no negative oil prices on April 20. There were negative *futures *prices, but that’s a different thing altogether. Oil is sticky, stinky, black stuff. A futures contract is a legal and financial instrument that doesn’t even exist except on paper and in computers.

The price of the May ’20 crude oil* futures contract *went negative on April 20,* **not the price of crude oil.*

The May ’20 contract was scheduled to expire the following day, April 21. Because demand for crude oil had fallen dramatically and storage was scarce (and expensive), buyers were also scarce. There were some market participants who had long futures positions and were thus going to be obligated to buy physical crude oil if they held the contract to expiration.

*Some of these participants, however, cannot take delivery for one or more reasons. So they needed to offset their positions at any price.*

I was as surprised as anyone when I first heard that the futures price for a commodity had fallen below zero. When you think about it, though, it makes sense that futures prices can go negative. Some commentators have claimed that the exchange should disallow negative commodity prices. That’s nonsense. If the exchange were to disallow negative oil prices, it would be equivalent to setting a daily limit price of zero. What if expiration is approaching and there are no buyers at a price of zero? The result is that you force people with long futures positions to take delivery. That would be a disaster – even if all market participants could financially handle it, do you really want a bunch of quants who know nothing about physical markets to be forced into taking delivery?

Note that there is only a single time when futures prices and physical prices are expected to be the same – that is the moment the contract expires. The rest of the time, we expect there to be a difference between the two prices. Sometimes the difference is large, sometimes it’s small. Increased volatility around expiration is certainly nothing new. Does it really matter whether the futures price is positive or negative? No, it doesn’t. P&L works the same either way.

The following day, April 21, the May ’20 contract expired at a price of $9.06. Yes, getting there was messy and not exactly orderly. But we got there. And the price wasn’t negative.

The post Negative Oil Prices? My Thoughts appeared first on I had this idea....

]]>Several years ago, I started a rewrite of my trading/research platform using Entity Framework and a relational back-end. It was my first experience using an ORM, so I read a few blog posts on whether I needed a separate data access layer (DAL) on top of the ORM. One school of thought says, no, the ORM *is *your DAL and whatever you do in an additional DAL is just duplication of effort. Always one to avoid unnecessary work, I went merrily on my way and used EF as my DAL.

Everything worked great. Well, maybe not great, but good enough. Most of the time I ignored lazy loading and proxy issues, but since the database was always local, performance was good enough, and when it wasn’t, I addressed the issues and moved on. My application code was peppered with data-model-specific functionality, but again, it was good enough for what I needed.

Fast forward five years.

I decided to move my database to AWS Aurora Serverless (more on that in another post). AWS Aurora offers a PostgreSQL-compatible version, which was awesome since my backend is PostgreSQL. The serverless features should save me a bunch of money, since I only use the database for about an hour each day. So, thinks I, piece of cake, I can move the database to the cloud, use a thick client, and then over time move more of the functionality into the cloud and out of the client. Yes, it will be slow because there will be Internet-level latency, but I can fixup the parts that are really, *really* slow. I’m the only user, so I’ll make it “good enough.”

Not so fast, buckaroo. From the AWS documentation: **“You can’t give an Aurora Serverless DB cluster a public IP address. You can access an Aurora Serverless DB cluster only from within a virtual private cloud (VPC) based on the Amazon VPC service.” **

What does that mean? In a nutshell, it means that the thick client running on my desktop can’t connect to the database. I need some middleware to sit between the client and the database. Ok, no problem, I’ll use the AWS API Gateway and some AWS Lambda serverless functions to access the database.

But wait. My DAL is Entity Framework. There are hundreds of instances of DbContext and DbSet in my application. I use DbContext as my unit of work. How am I going to port my application from using a DbContext that connects to a SQL database server to using HTTP API requests?

For about five seconds, I considered writing new versions of DbContext and DbSet that would implement the repository pattern and the HTTP requests and be the needed DAL. But remember, I’m using DbContext as my unit-of-work. All instances of DbContext in my application are short-lived. I usually create a DbContext, get some data from the database, and then destroy the DbContext. So to prevent an immense amount of traffic on the wire I would have to implement extensive caching – so much that I might as well just replicate the database locally, and that kind of defeats my whole objective, which was to remote the database.

I concluded that I need to move the application code away from EF and implement a custom DAL. The new DAL will comprise a set of repository classes that will handle all the HTTP requests and caching. The repository classes will serve up domain objects, not database objects.

Which is how I should have done it to begin with.

In Clean Architecture, Bob Martin states that the selection of a database system is a detail that should be put off until as late as possible in the development cycle. In my case, I selected an ORM before writing the application code. It strikes me that writing the application code before the selection of a database technology *forces* you to create an architecture that will be more flexible in the future.

The post EF, ORM, and DALs appeared first on I had this idea....

]]>The post Latest Project – Farmhouse Table & Bench appeared first on I had this idea....

]]>*Loss coherence applied to random variables; loss coherence matrix compared to correlation matrix; loss coherence for asset classes and trading strategies; some surprises…*

In the previous post, I created a way to measure the tendency of two investments to lose money at the same and called it *loss coherence*. Loss coherence (“LC”) is roughly analogous to correlation, except that it measures a very specific property of how two investments relate to each other.

In this post, we’ll look some actual values of loss coherence and compare them to correlation.

Because loss coherence is roughly analogous to correlation, it should have a mean value of zero when it is calculated for two random variables. I would also think it should be somewhat correlated to correlation. Chart 1 shows the result of generating two psuedo-random variables one thousand times and comparing the correlation with the loss coherence.

Note the following:

- As expected, for random variables, loss coherence is related to correlation. The correlation coefficient is .
- The median value of loss coherence for these 1,000 tests is zero.
- For these random variables, loss coherence varies approximately 4X faster than correlation and has a range of nearly -1 to +1, whereas correlation has a range of approximately -0.4 to +0.4.
- Loss coherence is quantized, and this is particularly obvious at values near zero. The quantization is due to the discrete nature of the binomial distribution.

No surprises here – so far, so good.

Let’s compare the loss coherence and correlation between several asset classes. The asset classes are:

- International equities (MSCI World Index)
- US equities (S&P 500 TRI)
- CTAs (SocGen CTA Index)
- Trend-following CTAs (SocGen Trend Sub-index)
- Hedge Funds (Barclay HF Index)
- REITs (Nareit US Real Estate Index)
- Bonds (continuation prices of Ten-Year Note futures)

We’re using monthly returns from Jan-2000 to Dec-2017, except for Ten-Year Notes, which starts in Feb-2001.

First, the correlation table:

MSCI World Index | S&P 500 TRI | SG CTA Index | SG CTA Trend Sub-Index | Barclay HF Index | Nareit US Real Estate Index | Ten-Year Notes | |
---|---|---|---|---|---|---|---|

MSCI World Index | 1.00 | ||||||

S&P 500 TRI | 0.97 | 1.00 | |||||

SG CTA Index | -0.10 | -0.14 | 1.00 | ||||

SG CTA Trend Sub-Index | -0.09 | -0.14 | 0.97 | 1.00 | |||

Barclay HF Index | 0.84 | 0.77 | 0.02 | 0.02 | 1.00 | ||

Nareit US Real Estate Index | 0.63 | 0.61 | 0.00 | 0.02 | 0.52 | 1.00 | |

Ten-Year Notes | -0.32 | -0.36 | 0.27 | 0.28 | -0.29 | -0.07 | 1.00 |

Now, the loss coherence table:

Loss Coherence | MSCI World Index | S&P 500 TRI | SG CTA Index | SG CTA Trend Sub-Index | Barclay HF Index | Nareit US Real Estate Index | Ten-Year Notes |
---|---|---|---|---|---|---|---|

MSCI World Index | 1.00 | ||||||

S&P 500 TRI | 1.00 | 1.00 | |||||

SG CTA Index | 0.63 | 0.43 | 1.00 | ||||

SG CTA Trend Sub-Index | 0.90 | 0.78 | 1.00 | 1.00 | |||

Barclay HF Index | 1.00 | 1.00 | 0.31 | 0.74 | 1.00 | ||

Nareit US Real Estate Index | 1.00 | 1.00 | 0.67 | 0.90 | 0.99 | 1.00 | |

Ten-Year Notes | -0.55 | -0.89 | 0.90 | 0.93 | -0.61 | 0.96 | 1.00 |

There are some surprises here. I’ve highlighted two places where the correlation and loss coherence are notably different.

One of the primary selling points of trend-following CTAs is their non-correlation to stocks. Looking at the correlation and loss coherence of the S&P 500 TRI and the SG CTA Trend Sub-Index, the correlation is -0.14. Highly uncorrelated, as expected. When we look at loss coherence, however, the LC is 0.78. So even though the two asset classes are uncorrelated, they both lose money in the same months at a far greater frequency than would be expected if the two classes were independent.

The same issue occurs with REITs and bonds. While the correlation is -0.07, the LC is 0.96. Once again, two uncorrelated return streams tend to lose money in the same months at a far greater rate than if the two returns streams were truly unrelated.

Let’s dig a little deeper into this second case. There are 203 months in the sample, 84 negative months for Bonds, and 74 negative months for REITs. So the probability of a lose/lose month is:

(1)

and the expected number of months when both investments lose money is:

(2)

The actual number of months when both investments lose money is 41, so there are 11 more lose/lose months than expected. This may not seem like a lot. Assuming the two investments are random and independent, however, we can use the binomial distribution to calculate the probability of this happening. The probability of having 41 or more months where both investments lose money is only 0.03.

The remarkable thing about cases like Bonds and REITs is not that the loss coherence is so high. The remarkable thing is that the loss coherence is so vastly different than the correlation coefficient.

One would expect that uncorrelated investments would tend to lose money at different times and that the frequency of periods when both investments lose money would be roughly the same as the binomial distribution suggests. In particular cases, however, we find this not to be the case.

Can loss coherence help build better portfolios? More research is needed to answer this question. It appears, though, that it can reveal some relationships between investments that are not apparent from looking at correlations.

The post Loss Coherence – Part II appeared first on I had this idea....

]]>The post Loss Coherence – Part I appeared first on I had this idea....

]]>I’m not a fan of correlation.

You can read that a couple of different ways. First, I’m not a fan of high correlations. Second, I’m not a fan of correlation coefficients in general, as they are often used in the financial industry. I’m addressing the second part in this post.

I could write a whole post on why I dislike correlation. Maybe another time. But briefly, let me point out something that has always bothered me.

Correlation measures the tendency of the month-to-month *change* in the returns of two investments to go in the same direction. In other words, if the returns for both investments are higher or lower by approximately the same amount this month than last month, that will tend to increase correlation. Conversely, if one investment has a higher return this month than last month and the other investment has a lower return this month than last month, that will tend to decrease correlation.

At no point in calculating correlation do we look at the returns of the two investments and ask whether either investment lost money, and more importantly, we never ask whether the returns of one investment tended to cancel out or reinforce losses in the other investment.

Instead, what if we ask the question, “What is the tendency of positive returns from one investment to cancel out negative returns from another investment? Conversely, what is the tendency for both of my investments to have negative returns during the same period?”

After all, isn’t that what we really want to know?

*Loss coherence* is the tendency of two investments to have negative returns in the same period. In the context of a portfolio, when an investment loses money, we would like for another investment to make money to offset the loss. What we *don’t* want is for all the investments in our portfolio to lose money at the same time. So loss coherence is a bad thing, and the more of it we have, the worse our portfolio is going to perform when it comes to drawdowns.

Loss coherence is roughly analogous to correlation of returns, in that the more of it we have, the worse our portfolio will perform. Where it differs is that it measures a very specific kind of correlation, the tendency of two investments to have negative returns at the same time.

In the rest of this article, I will define the *loss coherence coefficient * and begin to explore its behavior.

Consider the returns of two investments, and , over a period containing samples in each time series. If is the number of negative returns for in the period and is the number of negative returns for in the period, then, given that the returns are independent and randomly distributed, the probability of any given sample of having a negative return is and the probability of any given sample of having a negative return is . Further, the probability of both investments having negative returns in the same sample is

(1)

Throughout this post, we will use a test case for and where , , and . It’s trivial then to see that is .

The binomial distribution refers to the probability of having successful tests out of total tests, where each test has a binary outcome (i.e., it’s either successful or it isn’t) and the probability of any given test being successful is . It’s easy to calculate with the Excel Binom.Dist() function or any number of online calculators.

In the case of our two investments and , we have and . The PDF and CDF for this case are shown in Chart 1.

For this distribution, the *mode* is 15 and the probability of having 15 or fewer successful tests is 56.9%.

What if we examine the returns, however, and find there are actually 25 samples where both returns are negative? The probability of having 25 or more samples like this is only 0.3%. In this case, there are far more samples with both returns being negative than are predicted, so we can say that the losses are *highly coherent.* Since these two investments are likely to suffer losses at the same time, I might think twice before including both of them in a portfolio.

Conversely, what if there are only 8 samples where both returns are negative? The probability of seeing 8 or fewer occasions where both returns are negative is just 2.1%, so we can say that the *loss coherence is very low*, and including both of the investments in a portfolio would be a reasonable thing to do.

How might we quantify the difference between the actual number and the expected number of samples where both returns are negative? Because loss coherence is roughly analogous to correlation, I’d like to have a function that *looks like* correlation. In other words, the function should have a minimum value of -1, a maximum value of +1, and if we apply it to two random variables, it should have a mean of 0.

For the binomial distribution with tests and probability of success , let denote the cumulative density function. The binomial distribution has a mode of:

(2)

when is not an integer and denotes the floor of .

When is an integer, there are two modes with identical probabilities:

(3)

(4)

My strategy for quantifying loss coherence is shown graphically in Chart 2.

If the number of periods where both returns are negative is greater than or equal to (or ), then is the cumulative probability of successful tests minus the probability of the mode, divided by one minus the probability of the mode. In other words, is how far away from the probability of the mode the probability of successful tests is.

Likewise, if is less than (equal to or less than ), then is the probability of minus the probability of the mode, divided by the probability of the mode.

To formalize the definition of the loss coherence function , if is not an integer, then

(5)

when , and

(6)

otherwise.

If is an integer, then

(7)

when , and

(8)

otherwise.

Note that, like correlation, has a minimum value of -1, a maximum value of +1, and a value of 0 when the actual number of samples with two negative returns is equal to the mode.

Referring back to Chart 2, if we find 21 samples where both returns are negative, then the loss coherence would be:

,

which is a high loss coherence and might make them unsuitable for inclusion in the same portfolio. If instead we find only 9 samples where both returns are negative, then the loss coherence would be:

,

which is a very low loss coherence coefficient and would indicate they might be a good pair of investments to include in the portfolio.

Using the binomial distribution, we have defined a function that calculates the *loss coherence coefficient.* The loss coherence is roughly analogous to correlation of returns, except that it measures a very specific property, the tendency of two investments to lose money at the same time.

In the next post in this series, I’ll calculate the loss coherence for a number of different cases and begin to explore its behavior and how it might be useful.

The post Loss Coherence – Part I appeared first on I had this idea....

]]>The post CTA Style Analysis Using Average Weighted Trend Ratio (AWTR) appeared first on I had this idea....

]]>In the previous post in this series, we examined the relationship between the Average Weighted Trend Ratio (AWTR) and the rolling returns of the SG CTA Trend Index. We found a relatively strong relationship between the two time series, especially at higher values of AWTR.

While this relationship may be an interesting factoid for your next financial engineering cocktail party (which admittedly tend to be rather dull affairs), it’s not particularly useful for a portfolio manager in his day-to-day work.

So what practical uses might the AWTR have? In this post, we’ll take a look at how we might perform style analysis using AWTR. Can we use the AWTR to identify trend-followers and non-trend-followers? Can we use it to further categorize trend-followers into short-term, intermediate-term, and long-term?

In the first post in this series, I introduced the Trend Ratio (TR), a risk-adjusted measure of the “trend quality” in a market over a period of time. Conceptually, the TR should measure the ability of a trend-follower to harvest profits in a market over a specific time period.

In the second post, I showed how to calculate the AWTR for a portfolio of futures markets and then compared its values to the SG Trend Index, a benchmark for trend-following CTAs.

That was all mildly interesting, but now we get to the real question. What can we actually **do** with this thing?

The AWTR is supposed to be indicative of the ability of a trend-follower to make profits. If that’s true, we should be able to identify trend-followers by comparing their returns to AWTR values.

To test this idea, let’s use simple linear regression to compare the returns of two CTAs to AWTR values. The portfolio of futures markets used to create the AWTR is the same as was used in the previous post. The CTA programs are:

- Abraham Trading Company’s Diversified Program is described as using “a systematic, long-term, trend-following approach”.
- QIM’s Global Program uses “pattern recognition to predict short and medium-term price movements.”

Both CTAs have been in business for many years, and the analysis will run from Jan-2005 through Oct-2017.

The linear regression will posit AWTR as the independent variable and the CTA returns as the dependent variable. Several different AWTR lookback periods will be used in an attempt to determine whether a CTA’s returns are from short-, intermediate-, or long-term trend following (or not from trend following at all).

There is a complication in this, however. Note that each data point in the AWTR time series represents the potential profit opportunities available to trend-followers over a lookback period preceding that data point. For example, using a lookback period of 262, each daily AWTR value represents the potential trend-following profitability of the previous 262 trading days (inclusive). Because of this, it would be meaningless to try to compare the AWTR directly to the daily returns of a CTA.

Additionally, we have daily time series for the AWTR but only monthly returns for the CTAs.

The solution is to calculate several CTA rolling-return time series where the rolling-return lookback period corresponds to the AWTR lookback period, and to only use the last AWTR value of each month for the comparison. So for an AWTR period of 262, the dependent variable will be the CTA’s 12-month rolling returns. Using the last daily AWTR value for each month, we can now compare the AWTR looking back one year to the CTA returns over the same one-year period.

This technique, however, prevents us from using multiple regression because we now have multiple dependent variables to analyze. It would be preferable to run a multiple regression of the CTA returns against AWTR with different lookback periods and thus create a single model of the CTA returns. If any of you have ideas on how to resolve this problem, I’d love to hear about it.

Another issue with this method is that there is now a great deal of overlap between successive values in each time series. This issue will be ignored.

I used the Excel Data Analysis Regression function for performing the regression. Table 1 and Charts 1 – 3 show the results for the trend-following CTA vs the non-trend-following CTA and for different lookback periods..

Lookback Period | ||||||

Statistic | 1 Month | 3 Months | 6 Months | 12 Months | 24 Months | |

Trend-Following CTA | R^2 | 0.078 | 0.189 | 0.186 | 0.172 | 0.032 |

Regression Coefficient | 0.115 | 0.477 | 0.867 | 1.875 | 1.633 | |

P-Value | 0.000 | 0.000 | 0.000 | 0.000 | 0.027 | |

Pattern-Recognition CTA | R^2 | 0.000 | 0.003 | 0.037 | 0.053 | 0.218 |

Regression Coefficient | 0.006 | -0.045 | -0.283 | -0.917 | -4.520 | |

P-Value | 0.791 | 0.502 | 0.017 | 0.004 | 0.000 |

- The R^2 values for the trend-following CTA for the 3-month, 6-month, and 12-month lookback periods are nearly equal at 18% and the P-values are vanishingly small. This would seem to indicate the returns are related to the AWTR values with these lookback periods, which is what we would expect.
- The regression coefficient for the trend-following CTA for a 12-month lookback is 1.87, which is more than twice as large as those at 3 months and 6 months. This indicates this CTA’s returns come more from longer-term trend-following than from shorter-term trend-following (which agrees with their marketing literature).
- For the non-trend-following CTA, with the exception mentioned below, there doesn’t seem to be any relationship to AWTR, which again is what we would expect.
- For the non-trend-following CTA, the only relationship to AWTR that seems significant is the very long term AWTR with a lookback of 24 months. Indeed, the relationship here seems very strong with a coefficient of -4.5, R^2 of 22%, and an extremely small P-value. I would not expect this to be the case. My suspicion is that that this is somehow related to the fact that there is a great deal of overlap in each successive point in both the AWTR and rolling return time series. I haven’t addressed the overlap issue here at all, and a more sophisticated analysis would need to examine this issue.

The AWTR is a measurement of the ability of trend-followers to profit in certain markets during specific periods. It is important to note that it is derived directly from market price action and doesn’t rely on indexing of CTA returns or simulating a trend-following system.

Style analysis is used both prior to investment as part of the portfolio construction process and after investment to monitor and detect style drift. The analysis conducted here is not intended to represent a professional level of style analysis, but rather to illustrate that the AWTR may have practical applications in that area.

The simple linear regression results correctly distinguished between the trend-following CTA and the non-trend-following CTA, and also indicated the kind of long-term trends the CTA is trying to capture.

There are several ways the style analysis might be improved:

- The overlap issue identified above should be investigated to determine whether it is indeed an issue and whether it can be reduced.
- Instead of simply performing a style analysis for the entire track record of a CTA, it would be more interesting to perform the analysis over different time windows to see how the trend-following strategy evolved. Style drift would also be tracked in this way.
- We previously saw that the relationship between AWTR and the SG Trend Index was strong at high values of AWTR and weak at low values. I suspect that performing the regression only for higher values of AWTR would improve the ability of the analysis to detect trend-following and also to better distinguish between shorter-term and longer-term trend-following.
- Because of the long lookback periods used in the AWTR, the time needed to detect style drift is likely to be considerable. This is often a problem with style drift analyses. Can we detect shorter-term style drift?
- The AWTR could be customized if the specific markets traded are known. For example, a currency-only AWTR could be constructed for style analysis of a currency manager. This would also lead to detection of market and sector style drift.

The zip file contains two CSV files. “TRData.csv” is the raw Trend Ratio data. For each symbol, date, and lookback period, the NetExcursion, GrossExcursion, the ratio and absolute value of the ratio are shown. The other file, “Symbols.csv”, contains a key showing which futures products are indicated by the symbols.

THE DATA ARE PROVIDED AS-IS. USE AT YOUR OWN RISK. CTS ASSET MANAGEMENT LLC MAKES NO REPRESENTATION THAT THE DATA ARE CORRECT OR FIT FOR ANY PURPOSE WHATSOEVER.

The post CTA Style Analysis Using Average Weighted Trend Ratio (AWTR) appeared first on I had this idea....

]]>The post Average Weighted Trend Ratio for a Portfolio appeared first on I had this idea....

]]>

In this post, I’ll calculate the Average Weighted Trend Ratio (AWTR) for a portfolio of futures markets and see if it helps explain good and bad periods for trend-following CTA strategies.

In the previous post, I demonstrated how we can measure the quality of a price trend directly from price action. Briefly, we measure the absolute value of the net price movement over a lookback period (the profit potential) and divide it by the sum of the absolute values of all price movement during the same period (the risk). This gives us the Trend Ratio (TR), which is a risk-adjusted return ratio measuring the quality of trending markets.

To represent a simplified typical portfolio of a trend-following CTA, we use the markets and weights shown below. The portfolio includes both financial and energy markets, but is heavily skewed toward financial markets, as is the case with most large trend-following CTAs. Currencies and interest rates are weighted more heavily than stock indices. Smaller markets such as softs are not included.

Market | Weight | Market | Weight |
---|---|---|---|

British Pounds | 2 | Five-Year Notes | 2 |

Australian Dollar | 2 | Ten-Year Notes | 2 |

Euro Currency | 2 | BOBL | 2 |

Japanese Yen | 2 | Long Gilts | 2 |

Crude Oil | 1 | Euro STOXX 50 | 1 |

Natural Gas | 1 | E-mini NASDAQ | 1 |

Brent Crude | 1 | E-mini S&P 500 | 1 |

Gasoil | 1 | FTSE | 1 |

Each day, we calculate the AWTR for the portfolio as the weighted average of the TR values for each of the markets in the portfolio.

We’re interested in the relationship between AWTR and the returns from trend-following CTAs. The AWTR measures the average trending quality of the markets in the portfolio over a lookback period of *P.* On a daily basis, we’ll compare the AWTR to the sum (i.e. non-compounded) of the daily returns of the SG Trend Index (SGTI) over the same lookback period.

Chart 1 shows both the AWTR and the SGTI for lookback *P* = 262 days (approximately one year) for all samples in the dataset (Jan-2005 through Mar-2017). Click on each of the charts below to see a larger version.

Chart 2 shows the same data, but focuses on the latest five-year period:

We can also look at the two series for other lookback periods. Chart 3 shows the latest five-year period for *P* = 131 days (approximately six months) and Chart 4 is the same except *P* is now 524 days (approximately two years).

Visually comparing the two series seems to indicate there is a relationship, particularly over the last five years. Scatter plots should give us a better idea of the strength of the relationship.

Chart 5 shows the AWTR vs SGTI for lookback of *P* = 262 days over the entire dataset from Jan-2005 through Mar-2017. R² is 0.44.

The relationship seems particularly well defined for Average Weighted Trend Ratio values > 0.15. This seems reasonable, as we would expect a trend-quality measure to have more significance when markets are trending than when they aren’t.

Chart 6 shows the same data, but includes only AWTR values >= 0.15. The orange-colored outliers in the lower left are all values that occured in July 2009, when the outsized profits of 2008 turned into the losses of 2009. By limiting the data to AWTR >= 0.15, the value of R² rises to 0.54.

The relationship also seems stronger when only the last five years of data is considered. Chart 7 shows the scatter plot for the last five years for all values of AWTR and P = 262. In this case, R² = 0.81.

Considering other lookback periods, Chart 8 shows the last five years for *P* = 131. While there is still a relationship, it is somewhat weaker than when the lookback period is one year. R² = 0.63.

Chart 9 is the same except that P is changed to 524, or approximately two years. For this set of data, R² = 0.73.

- The Trend Ratio (TR) is an easily-calculated measure of the trending quality of a market for any particular lookback period.
- We can easily calculate the Average Weighted Trend Ratio for a weighted portfolio of markets (AWTR).
- There appears to be a meaningful correlation between AWTR and the rolling returns of the SG Trend Index.
- The strength of the relationship between the AWTR and the returns of trend-following CTAs depends on the particular weighted portfolio, the period of analysis, and the quality of the trends. Stronger trending markets lead to a stronger relationship.

Next time, I’ll discuss the practical applications of TR and AWTR, including the construction of customized trend-following indices and factor-based analysis of individual CTA returns. I’ll also post the TR data I’ve used and provide Excel and CQG formulas for calculating TR.

The post Average Weighted Trend Ratio for a Portfolio appeared first on I had this idea....

]]>The post Looking Back on Trend-Following (Part 1) appeared first on I had this idea....

]]>So why has trend-following been so bad? Just saying that “trend-following hasn’t performed well” is a pretty lame answer. Personally, I like to know the root cause of things. Moreover, if a root cause can be quantified, I like it even better.

I would like to have a quantitative measure that explains which markets were good for trend-followers and which markets were bad. If I can answer that question, then I should be able to quantitatively explain why trend-following was good or bad in different periods and even why one trend-follower may have done well while another one suffered.

The standard way of explaining trend-following performance is to refer to one of the trend-following indices.

There are essentially two types of trend-following index. The first type aggregates the performance of trend-following CTAs. The SocGen Trend Subindex is an example of this type of index. The second type synthesizes an index by aggregating the performance of one or more relatively simple trend-following trading models. The SocGen Trend Indicator is an example of this second type of index. (On the SG Prime Services Indices page, look under Daily Indices for links to these indices.)

Neither of these types of index attempt to directly relate trend-following performance to price action. In both cases, there are trading models that translate the price action into a return stream before it is included in the index. Rather than relying on an intermediate step, I want an indicator that will attempt to directly measure the “quality” of price action for trend-following.

The idea behind the Trend Ratio (TR) is to calculate a ratio between the net price movement (i.e. the return potential) and the gross price movement (i.e. “noise”) during a given period in a given market. Refer to the figure below for a graphical representation.

Trend Ratio = Net Price Movement / Gross Price Movement

The Trend Ratio is a risk-adjusted return measure. The return part of the ratio is the net price movement over the period. This is the amount of profit a trend follower could have garnered if he had entered a position at the beginning and exited the position at the end of the period. The risk part of the ratio is the gross price movement over the period. This is the sum of all the ups and downs the trend follower had to suffer through before closing the position.

As with all risk-adjusted return measures, higher values of TR are better than lower values. A value of 1 (one) means it was a perfect trend, moving only in one direction and never backtracking. A value of 0 (zero) means the market was perfectly non-trending, with no net price movement.

Now we have something we can use to quantitatively measure the quality of trending markets. The charts below show the result of applying TR to two different markets, Crude Oil and Euro currency. In both cases, TR is calculated on daily prices with a lookback period of 262 days (approximately one year of trading), and then smoothed and displayed on a weekly continuation chart for clarity. The blue histograms below the prices show the values of TR.

The results look promising. Values of TR grew as the collapse in oil prices gathered momentum in late 2014. As the downtrend failed and reversed, TR fell almost to zero. Early 2017 has seen some recovery in the quality of the trend, but nothing like two years earlier. Remember that the lookback period is one year, so each value of TR represents the quality of the trend over the previous year.

The chart of the Euro looks similar. The Euro collapsed in value from Q1 2014 to Q1 2015 in a very nice trend, resulting in sharply increasing TR. Since then, there has been very little long-term trending action in this market and TR has fallen back to almost zero. Again, the lookback period is one year.

The Trend Ratio is an attempt to relate trend-following performance directly to price action. I’ve shown how to calculate the Trend Ratio and displayed some evidence that it might do what I want it to do. TR seems to be able to identify periods during which specific markets were good for trend-following strategies.

In the next post in this series, I’ll calculate TR for a portfolio of futures markets and compare it to the performance of trend-following CTAs over the same period. If my hypothesis is correct, there should be a high correlation between TR and trend-following strategies.

The post Looking Back on Trend-Following (Part 1) appeared first on I had this idea....

]]>The post Spike? What Spike? (Or…Never Believe Anyone When They Talk About the Markets) appeared first on I had this idea....

]]>Friday morning, I woke up to Christine Romans on CNN breathlessly telling me oil prices had spiked overnight and had been up **a full ****2% at one point!** I rushed to my terminal to see how bad the damage (or how good the opportunity) was. Here’s the daily chart of CL I saw:

Spike? What spike? That’s not what *I* would call a spike.

A future post will deal with how to analyze price movements quantitatively, which will give us the basis for answering the question, “Just how did this price move compare to other price moves?” But for now, you can just look at the chart and say along with me, “Spike? What spike?”

To be fair to Ms. Romans and CNN, though, they weren’t the only ones looking like Chicken Little. Here are some of the other headlines from Friday morning:

*Oil near one-month high after U.S. missile strike in Syria (Reuters)* (Note that Reuters has changed the headline and the article this link points to. It’s pretty easy to be right when you can retroactively change what you said.)

*Syrian missile strikes drive oil prices to four-week highs* (The Telegraph)

Even Bloomberg (who you would think would know better) got in on the act Thursday night, although they had backed off somewhat by Friday morning:

*Oil Prices in New York, London Spike After Syria Attack: Chart (Bloomberg)*

The lesson is this:

**Never believe anything anyone tells you about the markets until you investigate it and come to the same conclusion independently.**

Not your best friend. Not your broker. Not the guy down the street who retired and now just trades for a living. Not even your mother. Don’t believe anyone.

And *especially *not the talking head in the box.

Dirty little secret: The role of the financial news industry is to keep you excited so you keep watching and they can keep selling commercials. The reality is it doesn’t matter to them whether or not they give you useful information, as long as they keep you excited and keep you watching. And 99% of the time, **they’re not giving you useful information.**

When I was first getting interested in trading I read Investment Psychology Explained by Martin Pring. It should be required reading for every new trader. Pring was the first person that clued me in to the fact that information from the financial news industry generally has no value whatsoever. None.

But it’s not their fault, it’s just their nature. (The scorpion and frog story should be inserted at this point, but you’ve all heard it and it’s really kind of a stupid story – I hate that story.)

So do your own work. Come to your own conclusions. And turn off CNBC.

The post Spike? What Spike? (Or…Never Believe Anyone When They Talk About the Markets) appeared first on I had this idea....

]]>