Trading The Equity Curve & Beyond

Some trading systems have prolonged periods of winning or losing trades. Long winning streaks followed by a prolonged period of drawdown.  Wouldn't it be nice if you could minimize those long drawdown periods?

Here is one tip that might help you do that. Try applying a simple moving average to your trading system's equity curve. Then, use that as an indicator on when to stop and restart trading your system. This technique might change your trading system's performance for the better. 

How to do this? Well, the moving average applied to your trading system's equity curve creates a smoothed version of your trading system's equity curve. You can now use this smoothed equity curve as a signal on when to stop or restart trading. For example, when the equity curve falls below the smoothed equity curve you can stop trading your system.  Why would you do this? Because your trading system is under performing, it's losing money. Only after the equity curve starts to climb again should you start taking your trades once again. This technique is trading the equity curve. You're making trading decisions based upon your equity curve. In essence the performance of your system is an indicator.

Trading the equity curve is like trading a basic moving average crossover system. When the fast moving average (your equity curve) crosses over the slower moving average (your smoothed equity curve) you go long (trade your system live). When the fast moving average crosses under the slower moving average you close your long trade (stop trading your live system).

In the image above the blue line is the equity curve of an automated trading system. The pink line is a 30-trade average of the equity curve. When the equity curve dips below the pink line, such as around trade number 60, you would stop trading the system. Once the equity curve rises above the pink line, around trade number 80, you would start trading.

It's a great idea and with some systems this technique can work wonders. In essence, we are using the equity curve as a signal or filter for our trading system. In the most simple case, it's a switch telling us when to stop trading it and when to resume trading. But you could also use this signal to reduce your risk instead of turning off the system.

How To Trade The Equity Curve

First you need to track all trades to generate the complete equity curve and moving average. This is done even if your live system has stopped trading. In other words, you will need to record the theoretical trades it would be taking. This means you will need to have two copies of your system running. One will is dedicated to taking every trade in simulation mode. This simulated system tracks the theoretical equity curve and computes the smoothed equity curve. No real trades would are taken by the simulated system. Its job is to track the two equity curves.

The second system is dedicated to trading live. This live system will have the ability to trade or not trade based upon the results computed by the simulation system. Think of the simulated system as an indicator. It's always running collecting data and crunching the numbers. This information will then be used by the live system to tell it when to trade and when not to trade.

One method to do this would involve passing data between two charts in TradeStation. Both charts are trading the identical trading system. One trades live while the other trades only in simulation mode. The chart running in simulation mode acts as your indicator. This indicator chart then passes a simple variable to the live chart. The live chart then acts on the live market.

This type of setup produces a dynamic trading system that adjusts its trading behavior based upon the system's performance. It's a simple concept, but it's complex to build in TradeStation. Some solutions that I've seen are also not very flexible. Overall solutions have proven to require complex programming skills and tedious setup to get this to work.

In short, building custom Easylanguage code to trade the equity curve has been very difficult to do. In fact, it has been well outside the ability of most programmers. But, not anymore.

Equity Curve Feedback Toolkit

There is a TradeStation product that can do all the heavy lifting for us! It is, the Equity Curve Feedback Toolkit. This kit allows me to use simple EasyLanguage functions within my code to trade the equity curve. It's super simple and will only take a few minutes to set up.  Let me show you.

I took an example trading system that appeared on System Trader Success called, A Simple S&P System. I then added the Equity Curve Feedback function to my code. Next, I made a couple minor adjustments to my code. Once done, the Equity Curve Feedback function now returns the simulated system's equity curve.

No need to use DLLs or other complicated setups!  With this information you can make a determination if the equity curve is above or below the smoothed equity curve. In other words, you can now turn-off or turn-on your live system based upon the equity curve!

First lets look at the results of Simple S&P System without the equity curve feedback. 

Simple S&P System With No EQ Feedback

You can see by looking at the equity curve the strategy got off to a bad start. See trades 20-40. Then the strategy had a nice run and a huge drawdown around trade 200.

The graph below is the underwater equity on a weekly basis. You can see at the start of trading and at the most recent trades, about a 12% drawdown.

Finally, here is the performance report of the S&P Simple System.

Adding Equity Curve Feedback

There are some adjustments to the original code required. For example, adding number variables and arrays. But at the heart of the issue is computing the equity curve of a simulated version of our strategy. That's difficult to do in EasyLanguage! But not any more.

Below is the line of code which does all the magic! That one line is what computes the simulated trades of our system. 

The next line of code is what enables or disables our live trading system. This function calculates the simulated equity curve of all trades. It then compares this value to the moving average of all simulated trades. It will then return true if the simulated equity curve is above the moving average. Else it will return false. 

I went ahead and added a 30 period moving average to the equity curve. Below are the results.

It's interesting to note the net profit is about the same. However, it generated this profit with fewer trades. That means many of the losing trades were eliminated. In fact, the average trade increased by about $50. Adding equity curve feedback reduced the drawdown by about half! Looking at the equity curve you can see the deep drawdown at the far-right side has been improved. Also, looking at the first few trades the equity curve looks much better.

You don't have to stop trading when the equity curve falls below its moving average. You could  adjust your risk. That is, if your equity curve begins to fall you can reduce the number of shares or contracts you trade. Or, when the equity curve is climbing, you need to increase your risk by buying more shares or contracts. You could also start or stop trading based upon drawdown or if the percentage of winners falls below a threshold. These are all possible with this kit.

Does It Always Help?

The short answer is, no. Trading the equity curve works well on some trading systems. Those systems tend to have prolonged periods of drawdown. Yet, other systems don't benefit from equity curve feedback. This is because the drawdowns are rather shallow and you end up hurting your equity more than anything. But like most things in the world of trading, you'll have to perform some testing. Test different moving averages and test between halting all trading or reducing contract/share size. Remember, some systems do not benefit from this technique at all.

Going Beyond With Multi-Agent Strategies

The Equity Curve Feedback Toolkit can also be use to create even more dynamic systems.​

For example, you can simulate many different variations of a single trading strategy. Maybe each of the simulated strategies has different input parameters. Instead of relying on a single set of input parameters giving a buy signal, you require two or more of the simulated strategies to give a buy signal. In effect you want confirmation from more than one strategy before taking a signal. This type of model is based upon on a voting scheme. When enough votes are counted - a trade is taken.

In another example you have multiple competing strategies. These strategies can simply be the same strategy with different inputs or they can be completely different types of strategies. A mean reverting strategy and a trend following strategy - for example. Based upon equity curve feedback, the strategy trade the best performing strategy in real time.

These examples are types of multi-agent strategies that can help make more dynamic and/or robust strategies. Such power was not widely available to the retail trader, but now it is.

Learn more about the Equity Curve Feedback Toolkit by clicking here.

About the Author Jeff Swanson

Jeff is the founder of System Trader Success - a website and mission to empowering the retail trader with the proper knowledge and tools to become a profitable trader the world of quantitative/automated trading.

follow me on:

Leave a Comment:

Add Your Reply