Algorithms for trading the equity curve

Discussions about Money Management and Risk Control.
damian
Roundtable Knight
Roundtable Knight
Posts: 815
Joined: Tue Apr 15, 2003 8:43 pm
Location: dusseldorf

Post by damian » Wed Jun 25, 2003 10:13 am

Here is what I am researching. So far I have only been able to work with single file tests:

If month end equity is below 2 month ECMA then close the position if it is a loser. If the trade is a winner, keep it open. This month is now flagged. If the trade is closed naturally by the trailing stop then take any new signals for the remainder of the 'flagged' month if the current EC value is greater than the previous month end EC value (if this is the case then the month is no longer flagged). If the current month remains flagged then only start taking new entry signals if *todays* end of day EC value, calculated by recording hypothetical trades, is greater than the 2 month ECMA (the flag is removed). At the end of the month, if the flag is still true then recalculate the 2 month ECMA and continue to record the daily EC by taking hypothetical trades as they are signaled. If in the next month the flag is still true (that is, you started the month flagged) and a hypothetical trade takes the daily EC above the current 2 month ECMA then enter the trade if you have less than X multiples of R in open profit on this hypothetical trade (X has been = 3 so far). The R multiple rule also applies to assuming a position in an open hypothetical trade during the month that the flag was set.

Essentially you 'exit' your long EC 'position' on monthly EC data and re-enter on daily EC data.

I have had to do all manner of fudges to try this out. My spreadsheet is not so pretty.

I still have a few flaws in my fudging, so I do not trust the results. However for the sake of it, the results are good if the data file is a winning market and has a few unusually deep and long DD's.

I would like to extend this concept to portfolio testing. In the event that EC at month end was < 2 month ECMA I would close all losing trades and hold open positions and ignore new signals whilst the flag was on. I would continue to accumulate the day's end equity curve (remaining open positions + results from hypothetical trades). The remainder of the method for the portfolio test is the same as the single file test. Take all open all already open hypothetical trades if they are winners and have open profit of less than X multiples of their initial R.

My hypothesis in the case of portfolio tests is that the results will be a function of the equity curve profile. If you already have a good EC that runs into the odd spot of trouble then the results would be good.

If your EC is choppy to begin with I think you will find that this approach will just give you second order whipsaws.

The other idea I have is to trade your long term trend following equity curve by switching on some kind of counter trend system when the monthly flag become true. You would still hold open trend following trades, both winners and losers (but obviously the net position would be flattened in some instances).

steady_jake
Full Member
Full Member
Posts: 22
Joined: Fri Jun 27, 2003 8:05 pm
Location: Warsaw, Poland
Contact:

Post by steady_jake » Sat Jun 28, 2003 12:08 am

To overcome this, the second method I have tested is as follows:
- only take the next trade if there has been an all time equity high within the last 20 trades.
Looks to me like a great way to curve-fit all sorts of things...or maybe I'm wrong...

Take care,

Jakub

Luke
Contributing Member
Contributing Member
Posts: 5
Joined: Wed Jun 11, 2003 9:12 pm
Location: Australia

Post by Luke » Mon Jun 30, 2003 1:47 am

It's hard to curve fit over 46,000 trades.

steady_jake
Full Member
Full Member
Posts: 22
Joined: Fri Jun 27, 2003 8:05 pm
Location: Warsaw, Poland
Contact:

Post by steady_jake » Mon Jun 30, 2003 4:30 pm

But you may always move towards achieving this... :wink:

By the way, I am curious if anyone of you would like to share their views on the possibility of curve-fitting money management models?

And how the extent to which the mechanical system has been potentially curve-fitted can be statistically measured?

Forum Mgmnt, what would you say?

I would appreciate any comments.

Forum Mgmnt
Roundtable Knight
Roundtable Knight
Posts: 1842
Joined: Tue Apr 15, 2003 11:02 am
Contact:

Post by Forum Mgmnt » Mon Jun 30, 2003 5:36 pm

Luke wrote:It's hard to curve fit over 46,000 trades.
A system that generates 46,000 trades is probably not curve fit, but the real issue is the number of times that your "Don't trade unless X happens" rule comes into effect. Your particular case strikes me as a pretty robust rule since it likely has thousands of instances where the rule goes into effect.

However, Jakub brings up what is probably the biggest problem with naive approaches to equity curve trading.

Consider a simple filter that tells you to stop trading when you get X% drawdown and resume trading when the virtual system gets back to a smaller % drawdown. If one chose a large number say 25% with a 15% restart, this might only occur five or six times in a 20 year test period for some systems. So the rule would only have five or six data points.

I imagine that with almost any system, one could devise a fairly simple rule that will make it test better. For long-term systems, this appears to me to be a slippery slope because of the limited number of data points that this will likely entail.

Any approach that has as an input a long-term trading system will result in an equity curve that is at least as long-term as the underlying system, if not more so. This means that trading the equity curve will be analogous to optimizing a long-term system for a single market, something I do not recommend under any circumstances.

Luke's approach seems better because it will result in thousands of data points. This may be as much due to the short-term nature of the system as the approach.

I think it is probably pretty hard, if not impossible, to trade the equity curve using a long-term system. While, it probably will work with short-term systems.

redbullpeter
Roundtable Fellow
Roundtable Fellow
Posts: 82
Joined: Mon Apr 28, 2003 9:12 am
Location: London, UK

Post by redbullpeter » Wed Jul 02, 2003 9:17 am

There is an article in the magazine Active Trader - Feb 2003 called "Drawdown Management".

It looks at different methods to use the equity curve to decide when to trade and not to trade.

A good read.

red

redbullpeter
Roundtable Fellow
Roundtable Fellow
Posts: 82
Joined: Mon Apr 28, 2003 9:12 am
Location: London, UK

Post by redbullpeter » Fri Jul 18, 2003 12:51 pm

Hi all,

Just had an idea and since I don't have the means yet to test it, I was wondering if somebody might like to try it out.

Volatility adjusted position sizing is pretty standard nowadays. What about volatility adjusted equity allocation? The idea being as the volatility of your equity curve goes up you adjust the proportion of your total equity available for each trade accordingly.

I imagine it would smooth out your equity curve quite a bit but possibly also reduce your returns as sudden upward movements in your equity would cause the system to scale back. You may be able counter that by differentiating between positive volatility (where equity curve is positive) and negative volatility (where equity curve is negative).

So...

System one could be:

Adjust equity allocation in relation to volatilty of the equity curve on the same principles as volatility adjusted position sizing.

System two could be:

Adjust equity allocation in relation to negative volatility. Allocate max proportion of equity for all positive volatility.

Anybody see any flaws? Anybody willing to try this out?

Cheers

red

TrendFriendly
Roundtable Knight
Roundtable Knight
Posts: 129
Joined: Thu Feb 19, 2009 2:35 am
Location: Phoenix, Arizona

Post by TrendFriendly » Sat Apr 24, 2010 2:34 am

Here's my addition to the "trading the equity curve" discussion. By my limited research detailed below I was convinced that filtering one's trades by how the equity curve is doing is a bad idea. In addition to what's below, I ran the above mentioned correlation test on the same data (1100 trades) offset by one trade and got a correlation of -.0426 which is practically zero.

Test details: a daily volatility breakout system tested on 5-minute EUR/USD data 1/2003-1/2010 risking 1% of equity on about 1100 trades.

Using Excel, each trade's result was filtered by a moving average of the equity curve as propounded by Joe Krutsinger et al. If the current system equity was above the moving average of the equity itself, a trade's result was counted. If not, the next trade's result was not counted. Hence, "trading the theoretical equity curve."

Results are reported as "x-times initial risk" or "R" in Van Tharpe's terminology. They are sums of the total "R-multiples" gained and therefore not compounded. For example, "522-R" means the sum of gains/losses for over 1100 trades was +522% since initial risk was 1% of equity. "100 trade MA" means the moving average of the total equity for the last 100 trades.

MA Length ------------------- Profit as sum of initial risk
No Filtering (all trades) ------- 522-R
100 trade MA ---------------- 486-R
40 trade MA ---------------- 451-R
30 trade MA ---------------- 434-R
20 trade MA ---------------- 399-R
10 trade MA ---------------- 315-R
5 trade MA ---------------- 250-R
3 trade MA ---------------- 163-R
1-trade MA ---------------- 195-R

It seems that a clear pattern emerges: the less filtering the better. That is, in the long run you can't do better than taking every trade.

Admittedly, this test is very limited in it's sample size and tested only one system. AND there may have been some improvement in drawdown, if I remember correctly. But overall, the results were enough for me not to pursue the idea further.

I welcome the thoughts by others on interpreting or adding to these results. I may be missing something important.

sluggo
Roundtable Knight
Roundtable Knight
Posts: 2986
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo » Sat Apr 24, 2010 10:03 am

It seems you have assumed that "Profit as sum of initial risk" is a good measure of Utility. Other traders might feel that different ways of measuring backtest results give them a better approximation of their own personal Utility. (That's why there are so many "goodness" measures around: different traders prize different things). The happy news is: each of you are "right".

My own Utility, just for example, is more along the lines of a Gain-to-Pain ratio. If something filters out profitable trades (reducing Gain), but reduces variability / drawdown-depth / drawdown-width / ulcer-index ("Pain") even more, then I personally would LIKE that filter. I'd just increase my leverage (futures trading) and be happy. But hey that's just me.

TrendFriendly
Roundtable Knight
Roundtable Knight
Posts: 129
Joined: Thu Feb 19, 2009 2:35 am
Location: Phoenix, Arizona

Post by TrendFriendly » Sat Apr 24, 2010 2:32 pm

Yes, Sluggo, my analysis was simplistic and quick and dirty. Have you found any improvement in other goodness measures by factoring in the equity curve?

sluggo
Roundtable Knight
Roundtable Knight
Posts: 2986
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo » Mon Apr 26, 2010 8:27 am

Yes, I recommend you invent, code, and backtest a dozen different ways to let the equity curve up through today, influence the way you trade tomorrow. I predict that some of them will indeed improve whatever goodness measures you choose. (Whether or not they improve the goodness measures "enough", to justify the increase in system complexity and parameter count and danger-of-overfitting, is of course a subjective judgment that only YOU can make.)

Notice that the equity curve can influence your trading behavior. It can do so through the extremely crude mechanism of completely nullifying new entry signals, i.e., multiplying the positionsize by 0.000000001. But the fertile mind of man can invent other creative mechanisms of influence besides simplistic on-off switches. Perhaps, like the Turtle Failsafe Breakout idea, you can use the equity curve to influence (modify) your entry criterion (55 day breakout instead of 20 day breakout?) Perhaps you can multiply positionsize by some other number than 0.000000001. There are an infinity of other possibilities, limited only by your imagination and creativity and willingness to put in the effort.

Kiwi
Roundtable Knight
Roundtable Knight
Posts: 513
Joined: Wed Apr 16, 2003 1:18 am
Location: Nowhere near

Post by Kiwi » Mon Apr 26, 2010 6:39 pm

I make this comment as someone who has implemented this recently - not as someone familiar with the/any theoretical underpinnings.

I'd suggest that EC management be:
- really simple (ma or donchian breaks)
- be applied because you recognize that the market has periods where it does X which is inimical to your system's profitability; not because it might work
- be crude and under-optimized.

Post Reply