Ernest Chan on Trading with Composer
Learn about investing from author Ernie Chan. Explore Ernie Chan's thoughts on algorithmic trading and more with Composer.
Getting started is often the most challenging part of investing. Like writing an email or staring at the blank screen, it can be difficult to form the first few sentences and get moving. I can’t tell you how much time I’ve spent staring at a blank google doc preparing to write the weekly blog.
I know many of you may have similar feelings about investing with Composer and building systematic strategies. Fortunately, we have brought in an investing rockstar to share his thoughts. Ernie Chan is an investor, author, and entrepreneur who has developed numerous successful trading strategies. His book Quantitative Trading: How to Build Your Own Algorithmic Trading Business is required reading for anyone interested in systematic investing. In addition, his new company Predictnow.ai helps hedge fund managers and retail traders refine their investment strategies.
Ernie and I chatted about his career, developing strategies, and Composer. In particular, we discussed how investors can get started developing symphonies and Ernie’s thought process for taking advantage of mean reversion. [1] We also covered how a new machine learning technique developed by Predictnow.ai can help investors refine their strategies. Below is an edited version of Ernie’s thoughts with my commentary added. Enjoy!
Ernie’s opinions and conclusions are his own and should not be considered investment advice. Investing involves the risk of loss, including principal, and returns are not guaranteed. This writing is an uncompensated testimonial from a current Beta user of Composer.¹

Ernie: Sixteen years ago, I was a defeated institutional trader, having failed to build profitable algorithmic trading strategies, despite working at some of the best places on earth to do so. I left New York and hunkered down in my Toronto home trying to figure out my next act. I thought: if complex didn’t work, let’s try simple. That began a journey that took me from finally trading profitably as a retail trader to becoming a popular author, an award-winning fund manager, and a financial machine learning entrepreneur.
I’m excited about how new technologies can help you do this much more easily today. With the advent of no-code backtesting tools like Composer, it is easier than ever for retail traders to build simple and profitable strategies all on their own.
Kyle: Simplicity is foundational to Composer. The visual editor and backtesting tool are designed to make systematic investing intuitive. And this is critical because backtesting is an essential ingredient for developing strategies. It is our feedback loop and sanity check. We talked about this a few weeks ago in our Bringing it Backtesting blog.
“Backtesting is a method of evaluating an investment strategy by looking at how it would have performed in historical market conditions. It lets you see what it would have been like to go back in time and implement that idea in the past.”
Backtesting is particularly helpful for dynamic strategies that respond to market conditions and prices. If we assume that a strategy was implemented in the past, we can play the tape forward and note how it performed. Now we have returns, standard deviation, max drawdown, and other metrics for our symphony. Importantly, it lets us test the relationship between assets over time.
Ernie: So how do we start simple? Is buying low and selling high simple enough? In a sense, it is, with some caveats. Not every financial instrument that went down will necessarily go back up again, as those of us old enough to remember Enron and Pets.com can testify.
In trader-speak, those instruments that do so are called “mean-reverting.” The bad news: most stocks don’t mean-revert (except over some short time periods). They either go up, up, and away like Amazon, or down, down, and to the drain like Enron.
What mean-revert more reliably are pairs of similar stocks, or even better, pairs of similar ETFs. My favorite example is GDX and GLD, the gold miners and the gold ETFs. (Disclaimer: this is purely a toy example. We are not claiming that buying and selling this pair as described below will lead to actual profits without many adaptations and fine-tuning. Never trade a strategy until you backtested it, and equally importantly, walk-forward-tested it.)
Intuitively, if gold goes up, the gold mining companies’ stocks should also go up, and vice versa. If they haven’t yet done so, that would be a temporary deviation from the mean that we can exploit to our profit. To be more exact: if we form a portfolio that longs GDX and short GLD, in some proportion, there is a good chance that the market value of this portfolio will revert to some long-term mean after some temporary deviations. You can therefore buy this portfolio (equivalent to buying GDX and shorting GLD) when it is cheap and sell it when it gets expensive. You can also short this portfolio when it is expensive (i.e., shorting GDX and buying GLD) and buy it back when it gets cheap.
A few nuances: how much of GDX and GLD should we hold in this portfolio? Equal capital weight or some other “hedge ratio”? (Hedge ratio is the number of shares of GLD we should short per share of GDX that we long.) Determining the optimal hedge ratio can be quite tricky, involving linear regression or fancy algorithms such as the Johansen test or Predictnow.ai’s Conditional Parameter Optimization. But here, let’s use the “risk parity” allocation: making sure that the capital weights of the two legs contribute equal volatilities to the portfolio. This is easy to do in Composer, using the inverse volatility weight function.
Kyle: As Ernie mentions, this is a toy example, but what I want to call attention to is his thought process. Composer is all about this type of thinking - identifying relationships and patterns that you can potentially exploit.
What other relationships or pairs come to mind? Rising interest rates and Financial Sector ETFs, commodities and inflation, US and international equities, the value and momentum factors, equity market volatility and returns. All of them can be fodder for symphonies!
Let’s take a look at GDX and GLD and consider the simplest version of this strategy we can implement. We use Composer’s if/then logic to set up our conditional. If the 10-day moving average return of GLD is below the 10-day moving average of return for GDX, then we could consider gold “cheap” relative to gold miners, and we would buy GLD. We would buy gold miners (GDX) if the inverse were true.

This symphony is a simplified version of a toy example, so take the results with a grain of salt; however, over the last three years, it outperformed GLD and GDX.

April 6th, 2019 - April, 5th 2022
Ernie is right that developing strategies takes iteration and fine-tuning. In my example above, we created a long-only symphony, meaning there is no short selling. We are exposed to the price of gold and moves in the equity market. In Ernie’s long-short example, he is technically market and gold neutral. He is long one asset (GLD) and short another (GDX), so portfolio returns should be driven only by differences between GLD and GDX–not caused by changes in the price of gold or equity market trends.
To refine our simple strategy in Composer, we could include inverse ETFs to approximate short selling and use inverse volatility weightings to build a portfolio less exposed to the price of gold and the equity market. Or we could test other ways to signal that gold is cheap relative to gold miners. Composer makes tinkering fun! We identified a relationship between two assets, and now we can test multiple ways to implement it.
Ernie: Before you trade with real money, though, you should always first try paper trading (a.k.a. “walk-forward testing”). The purpose of paper trading is to see whether you have “overfitted” your backtest to historical data and thus generated unrealistic performance. Often, new traders create overly complicated trading rules to capture some one-off market patterns that never recur. This is called overfitting and is the curse of algorithmic and discretionary trading alike. If you find that your paper trading account’s performance is far below your backtest performance over a significant period, then you have likely overfitted. (How long a period is “significant”? See Chapter 3 of Ernie’s book Quantitative Trading, 2nd Edition.)
Kyle: There are biases and mistakes that investors must avoid with backtesting. We detailed some of them in the backtesting blog. The TLDR? Be forward-looking, test multiple periods, and think of backtest results as insights, not prelude to future performance.
But Ernie raises a great point about testing strategies out of sample. Using Composer, investors can Follow symphonies they’ve created to monitor performance in live markets. Investors can take note of the backtest results and then compare them to a symphony’s “forward” performance. As Ernie mentions, if there is a significant deviation between the live and backtested performance, it may signify that the strategy isn’t capturing the intended relationship.
Relatedly, the Composer backtest can estimate trading costs. This tool is helpful to evaluate whether a relationship exists between assets (i.e., a signal that creates positive returns or reduces volatility) AND the signal can be traded effectively (i.e., trading costs do not erode the anticipated benefit). Investors can toggle fees on and off during testing to evaluate the impact of turnover on symphony performance.
Ernie: You may think that your backtest and research journey ends after starting live trading, but it doesn’t. No matter how well the strategy may perform in the short run, it will inevitably run into tough times (unless you are a high-frequency trader, which is unlikely if you are new to this business).
Before you toss out the strategy during these tough times (technically called “drawdown periods”) or make radical changes to your trading rules, consider some simple adjustments. You may notice that the strategy coded above includes the parameter 10 in the “10d moving average of return”. Why 10 and not some other number? Probably because 10 worked pretty well on average over the entire backtest period.
Yet this number may not be optimal during some market regimes. Those regimes are the ones that cause drawdowns. You would want to find a different set of parameters in different regimes, but how? Here is where machine learning can help. Our team at Predictnow.ai has invented a machine learning technique called “Conditional Parameter Optimization” which uses many market indicators to predict the optimal parameters of a trading strategy in a future period. We discovered that this scheme works in many case studies. If you are interested, check out our website or reach out for more information.
Kyle: We say it all the time here at Composer HQ, “Nothing works in all market environments.” Symphonies will hit rough patches and, occasionally, may need tweaks; however, investors shouldn’t dump strategies or overhaul them at the first sign of turbulence. Jumping from symphony to symphony based on strong backtested returns is performance chasing and an excellent way to underperform.
Ernie is a seasoned trader, and he has the profits (and losses) to back up his perspective. I highly recommend reading his book and checking out Predictnow.ai to see the future of quantitative trading.
A huge thank you to Ernie for sharing his time and wisdom with us.
Important Disclosures
Investing in securities involves risks, including the risk of loss, including principal. Composer Securities LLC is a broker-dealer registered with the SEC and member of FINRA / SIPC. The SEC has not approved this message.
Certain information contained in here has been obtained from third-party sources. While taken from sources believed to be reliable, Composer has not independently verified such information and makes no representations about the accuracy of the information or its appropriateness for a given situation. In addition, this content may include third-party advertisements; Composer has not reviewed such advertisements and does not endorse any advertising content contained therein.
This content is provided for informational purposes only, as it was prepared without regard to any specific objectives, or financial circumstances, and should not be relied upon as legal, business, investment, or tax advice. You should consult your own advisers as to those matters. References to any securities or digital assets are for illustrative purposes only and do not constitute an investment recommendation or offer to provide investment advisory services. Furthermore, this content is not intended as a recommendation to purchase or sell any security and performance of certain hypothetical scenarios described herein is not necessarily indicative of actual results. Any investments referred to, or described are not representative of all investments in strategies managed by Composer, and there can be no assurance that the investments will be profitable or that other investments made in the future will have similar characteristics or results.
Charts and graphs provided within are for informational purposes solely and should not be relied upon when making any investment decision. Past performance is not indicative of future results. The content speaks only as of the date indicated. Any projections, estimates, forecasts, targets, prospects, and/or opinions expressed in these materials are subject to change without notice and may differ or be contrary to opinions expressed by others. Please see Composer's Legal Page for additional important information.