Exclusive Interview | Quant Expert Cesar Alvarez

Cesar Alvarez attended the University of California, Berkeley where he received his Bachelors of Science in Electrical Engineering and Computer Science in 1989 and his Masters of Science in Computer Science in 1990. Cesar was a Software Engineer on Excel versions 3, 4, and 5, helping Microsoft Excel go from single digit market share to owning the market. Cesar spent nine years as a professional market researcher for Connors Research and TradingMarkets.com. Cesar has been at the forefront of stock market research, having developed a number of successful trading systems now used by numerous investors and fund managers in the United States and internationally. Cesar has given trading presentations both over the web and in person to hundreds of traders.

Grace: You are the founder of Alvarez Quant Trading, can you tell us more about what inspired you to start your business?

Cesar:  I really like talking to other traders and doing research more directed at my own interests and the blog is my way of doing that. I like to update it every three weeks or so which forces me to keep doing research. It also gives me the exposure and the ability to talk to other traders. I tend to focus mostly on helping the beginning quant trader, focusing on the simpler concepts because when I first started with Larry Connors, he always was helping out the beginner so I guess that idea got instilled into me. Both on the blog and through private consulting I help beginning traders understand how to get started, teach them about some of the pitfalls you can run into and essentially just help point them in the right direction.

Liza: In relation to the S&P 500, do you think that markets are trading efficiently and if so do you think it comes back to people approaching the market in a quantitative way?

Cesar: I think definitely over the last five years or so, the markets have gotten more and more efficient just because there are a lot more people trading quantitatively and there’s a lot more funds trading this way. Edges that I was trading a decade ago still exist but they are much more muted, and I see in a lot of my strategies there was definitely a change in the market about five years ago. A lot of strategies are still profitable but they’re just not as profitable anymore, which makes things a bit frustrating when you’re used to trading much larger edges. Fortunately they still exist enough to make it worthwhile to trade but hopefully they don’t keep shrinking to the point where they aren’t worthwhile. So yes, I do think markets are getting much more efficient with all the quantitative trading that’s being done nowadays.

Liza: About a third of capital flows in today’s market are heading to quantitative hedge funds. What do you think is contributing to that shift?

Cesar: I think it’s becoming more popular and well known. The quantitative method has been around for a long time but as people are becoming more comfortable with it some of these larger funds with quite a track record are starting to allocate their money towards quantitative hedge funds.

Liza: Going forward into the evolving market what data do you think will become increasingly relevant to decision making in trading?

Cesar: I’m still quite surprised at how expensive fundamental data is, and how difficult it is to get and/or use. Hopefully that somehow becomes cheaper in the future so that I can test fundamental ideas to see if there’s something that can be incorporated along with the technical side.

Grace: What do you think is something that traders take for granted?

Cesar: The biggest thing that I think traders tend to assume is that their data is just fine. I find that people are always surprised when they find problems with their data. The other one I would say is position sizing. People often come to me with very complicated position sizing algorithms and it’s quite surprising how often a very simple allocation works almost as well, sometimes even better. I find people are always trying to overcomplicate things when simple works just as well.

Liza: You mentioned in a blog post that you don’t often do out-of-sample testing and when you do you do it differently than most traders. Can you explain what you mean?

Cesar:  Whether I do in or out-of-sample testing really depends on what kind of data I have. If I’m testing my volatility strategy which only has data back to 2011 there’s not enough data for me to comfortably break it up between out-of-sample and in-sample. Now on my stock strategies I have data back to 1990 and that gives me much more room to do both in-sample and out-of-sample testing. Let’s say I want to test back to 2000. Traditionally people may recommend testing a strategy from 2000 to 2007 as the in-sample test and from 2008 to 2017 as the out-of-sample test. I actually reverse that, which is the first step that I do quite differently. My in-sample data will be the most recent period from 2008 to 2017 because I want to, in a sense, test my strategy to the most recent market environment. I believe markets change as they go along so if I test my strategy in a much older environment I think the current environment is going to be too different.

As another example, let’s say a trader is doing a very simple moving average strategy with a 20-period moving average and a 120-period moving average and then they test that strategy out-of-sample and then use that one test to determine whether or not it worked. I do this quite differently. I do a sort of parameter sensitivity testing, so instead of testing just the 20-period and the 120-period moving average I’ll test a lot of random moving averages around the 20 and the 120—so for example I may test the 18 and a 117, or the 21 and the 119. I then have a lot of different variations and I take the aggregate of those variations to see how well they did. A strategy may test really poorly out-of-sample while all others perform on average quite well and you would have rejected something that would that have done well. Or on the other side, you may pick something that just happened to test well out-of-sample but most of the other variations would have performed poorly. The way I tend to do it is a lot of work to do and I understand why people don’t do it that way but when money is on the line I don’t mind doing to the extra work.

Grace: When you introduce a new rule to your trading system how do you determine if it’s robust?

Cesar: When building a trading strategy and adding rules I really don’t care if it is robust at that particular point. What I care about is does the rule make sense, is the rule overfitting, am I trying to overfit a drawdown or a bad trade? Sometimes I find people try to add a rule because it eliminates a really bad trade and that tends to lead to overfitting.

When I’m done with a strategy, at that point I check to see if it’s robust. Let’s say I have ten rules in the strategy (this many would be pretty rare for me) I remove each of the rules one by one and see if that rule actually still makes sense. Does it really help my strategy, or is it just extraneous? You’d be quite surprised how, in the end, you can start removing rules that you added and they really don’t make any difference. So that’s the first step, then I do a parameter sensitivity test with all my rules. What that means is I gradually tweak each of the parameters, so let’s say one parameter is a 50-day moving average so I’ll try a 49 or 48 or 51 or 52 just to make sure that there is not a huge change in my results from that.  So those are the things I do to verify that the rule makes sense and it’s not overly optimized to some particular thing in the strategy.

“Sometimes I find people try to add a rule because it eliminates a really bad trade and that tends to lead to overfitting”

Grace: You’re not only a trader but you also teach a course for those with little to no programming skills where you teach them how to create a trading strategy and run a backtest. Can you tell us more about that?

Cesar: Yes– the tools I use to do most of my backtesting is AmiBroker, which is really great backtesting and charting platform but it’s a bit complex, and Excel. I have a course about AmiBroker for people who are trying to get into it but don’t have a programming background. First I teach the basics then I have the students write a mean reversion strategy and a breakout strategy (the mean reverse strategy actually works, the breakout strategy doesn’t actually work) so we go through a lot of the basics. The idea of the course is to get somebody started in quantitative trading using AmiBroker to start testing their ideas on a very basic level. Some of my students have had really good success learning AmiBroker and learning the concepts of quantitative trading from that course. AmiBroker is a great platform but it is also quite difficult to learn on your own. There are some great books on it, I often recommend Howard Bandy’s book called Introduction to AmiBroker which is also a great resource for people who are trying to learn the platform on their own.

Grace: What do you think is one of the biggest challenges that new quant traders face when entering the industry?

Cesar: Oftentimes I see newer traders try to overcomplicate everything. People come to me with 15-20 different and really strange rules that are overly complicated. Especially when they first get into programming, they realize the power of it and they realize they can just keep adding rules quite easily and then optimize each of their parameters. Once you’ve got down to basics it’s really quite powerful and it becomes really easy to shoot yourself in your own foot because you over-optimize your strategy to a very specific case that maybe would not have worked well in the future. That’s one of the biggest tripping points I see with new quantitative traders as they start to learn how to test their own ideas, they start throwing everything at a strategy just to make it work perfectly.

“Oftentimes I see newer traders try to overcomplicate everything.”

Liza: How do you help them overcome these challenges?

Cesar: I’ll tell them to start removing rules and see how that affects the results and teaching them to see what happens if they do a little bit out-of-sample testing just because often when you’ve done an out-of-sample test the results become horrendously poor. Even a quick out-of-sample test with their parameters or just a couple small tweaks without going through the difficulty of doing a proper sensitivity test often shows them that they have probably got it a little over-optimized.

I also have them walk through and explain why each rule was there conceptually. Oftentimes I find a trader has a rule in the strategy because they were trying to get rid of a particular trade, at which point it becomes clear they are overfitting the strategy. I have the trader try to articulate why each rule is there and we can often figure out the rule is there not because it’s generally a good concept for the strategy but because the trader is trying to minimize a particular bad trade, which is never a good thing to be doing.

Liza: On another note what particular programming languages do you think are best for data analysis?

I think it’s a matter of just finding the tools that you like. I think that’s a better way of doing it versus   picking a language to learn and then figuring out how to use it. A common problem I run into is computer programmers wanting to write their own backtesting platform from scratch because they think they can do it better. Don’t waste your time doing that, pick a program that already does all the hard work and just learn that programming language. It saves you a lot of work and you’ll get up and running much faster versus writing your own backtesting platform from scratch.

Grace: Your website is Alvarez Quant Trading where traders can read your blog as well as learn more about consulting services you offer.  What are your top two books or articles for traders that are just starting out in the quant trading industry?

Cesar: Howard Bandy had several really good books, of which I would recommend Quantitative Trading Systems and Mean Reversion Trading Systems. Additionally I’ve written two books with Larry Connors that I think are good for getting started, Short Term Trading Strategies that Work and High Probability ETF Trading.

Grace: What is one of the current trends in the industry that you’re excited about?

Cesar: The very popular trend right now is machine learning and that has definitely got me excited. I have spent some time over the last nine months learning about it trying to see how I can integrate it into my trading. It’s got me excited but also very worried in a sense because it is a tool which can be easily abused by the beginner to overfit strategies and develop strategies to be really overfit to the market. However, I do believe there is quite a bit of potential for it to be integrated in trading but it will take a lot of time to get it up and running and understand the system.

Grace: What advice would you give traders who are just starting out in this field?

Cesar: I’d say the biggest thing is just be patient. Don’t look to get that huge return right away. Be OK with drawdowns. People come to me oftentimes with 15% drawdown or 10% drawdown. People are just not comfortable with drawdowns but I think getting comfortable with it is important. If you look at all the big traders they have big drawdowns– Warren Buffett has huge drawdowns. All strategies have drawdowns and they’re not necessarily all tiny and I think you just have to get used to that.

I’d also say learn how to program. Learn how to do your own testing, find a platform that you like, try a couple of the platforms and see which programming language makes sense to you and go from there. I think learning how to do your own testing is important because if you develop a strategy yourself I think you’re much more likely to continue trading it when it starts losing money. All strategies will go through a period of under-performance at one point and if you’ve done the work yourself I think you’re much more likely to keep trading it. I think as quant traders we often stop trading strategies too early, when they may not have stopped working but are just going through a quiet period.

“All strategies will go through a period of under-performance at one point and if you’ve done the work yourself I think you’re much more likely to keep trading”

Start Algo Trading Today!

Get your free token to connect to the REST API and start trading. To generate your token:

  1. Register for a free practice account here.
  2. Log into fxcm.com and click on the account ID in the upper right corner.
  3. Click token management and generate your token.

Risk Warning: The FXCM Group does not guarantee accuracy and will not accept liability for any loss or damage which arise directly or indirectly from use of or reliance on information contained within the webinars. The FXCM Group may provide general commentary which is not intended as investment advice and must not be construed as such. FX/CFD trading carries a risk of losses in excess of your deposited funds and may not be suitable for all investors. Please ensure that you fully understand the risks involved.