Algorithms for trading the equity curve
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 reenter 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).
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 reenter 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).

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

 Full Member
 Posts: 22
 Joined: Fri Jun 27, 2003 8:05 pm
 Location: Warsaw, Poland
 Contact:
But you may always move towards achieving this...
By the way, I am curious if anyone of you would like to share their views on the possibility of curvefitting money management models?
And how the extent to which the mechanical system has been potentially curvefitted can be statistically measured?
Forum Mgmnt, what would you say?
I would appreciate any comments.
By the way, I am curious if anyone of you would like to share their views on the possibility of curvefitting money management models?
And how the extent to which the mechanical system has been potentially curvefitted can be statistically measured?
Forum Mgmnt, what would you say?
I would appreciate any comments.

 Roundtable Knight
 Posts: 1842
 Joined: Tue Apr 15, 2003 11:02 am
 Contact:
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.Luke wrote:It's hard to curve fit over 46,000 trades.
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 longterm 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 longterm trading system will result in an equity curve that is at least as longterm as the underlying system, if not more so. This means that trading the equity curve will be analogous to optimizing a longterm 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 shortterm nature of the system as the approach.
I think it is probably pretty hard, if not impossible, to trade the equity curve using a longterm system. While, it probably will work with shortterm systems.

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

 Roundtable Fellow
 Posts: 82
 Joined: Mon Apr 28, 2003 9:12 am
 Location: London, UK
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
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

 Roundtable Knight
 Posts: 129
 Joined: Thu Feb 19, 2009 2:35 am
 Location: Phoenix, Arizona
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 5minute EUR/USD data 1/20031/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 "xtimes initial risk" or "R" in Van Tharpe's terminology. They are sums of the total "Rmultiples" gained and therefore not compounded. For example, "522R" 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)  522R
100 trade MA  486R
40 trade MA  451R
30 trade MA  434R
20 trade MA  399R
10 trade MA  315R
5 trade MA  250R
3 trade MA  163R
1trade MA  195R
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.
Test details: a daily volatility breakout system tested on 5minute EUR/USD data 1/20031/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 "xtimes initial risk" or "R" in Van Tharpe's terminology. They are sums of the total "Rmultiples" gained and therefore not compounded. For example, "522R" 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)  522R
100 trade MA  486R
40 trade MA  451R
30 trade MA  434R
20 trade MA  399R
10 trade MA  315R
5 trade MA  250R
3 trade MA  163R
1trade MA  195R
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.
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 GaintoPain ratio. If something filters out profitable trades (reducing Gain), but reduces variability / drawdowndepth / drawdownwidth / ulcerindex ("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.
My own Utility, just for example, is more along the lines of a GaintoPain ratio. If something filters out profitable trades (reducing Gain), but reduces variability / drawdowndepth / drawdownwidth / ulcerindex ("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.

 Roundtable Knight
 Posts: 129
 Joined: Thu Feb 19, 2009 2:35 am
 Location: Phoenix, Arizona
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 dangerofoverfitting, 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 onoff 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.
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 onoff 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.
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 underoptimized.
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 underoptimized.