Effects of a Portfolio Wide Stop Loss on Trading Strategy Performance

15 05 2014

Background

The daily returns of our trading strategy can be volatile, especially during periods of extreme overall market volatility across asset classes. During these times, multiple signals are usually triggered within the same asset class which has the effect of amplifying the daily gains/losses of the trading system. The greatest daily gain/loss amounts have been more than 9% historically. A day when 9% of account equity could be lost is difficult to stomach for any investor, institutional investors especially.

Every position that the strategy trades is equipped with its own stop loss order, however we would like to investigate the idea of a portfolio wide stop loss. With a portfolio wide stop loss, we would like to exit all positions if the account equity drops by x% in a single day, This could help mitigate the risk of seeing another day with losses greater than 9%.

Test Process

For this test we used intraday data from IQFeed and the dates of our actual historical trades. A custom component was written for Multi Charts to read the strategy’s trade history and map the execution dates to the intraday data. A new strategy for MultiCharts was then written to close all positions once the account equity dropped below a specified amount on any given day.

All 19 futures markets that the strategy trades were loaded into MultiCharts and the historical data was separated into an in-sample and out-of-sample group. The in-sample data range was 7/2007 – 7/2010, and the out-of-sample data range was 8/2010-4/2014.

A baseline test scenario was run on the in sample data with no portfolio stop loss with additional tests run with stop loss values ranging from 2%-7%. The best performing stop loss would be selected, and tests would be run on the out-of-sample data for each stop loss level to see how they performed moving forward.

The test cases would assume a starting account equity of $1MM, and slippage would vary based on commodity, ranging anywhere from $0 – $100 per contract depending on historical slippage that has been observed in each of the markets that are traded.

The goal of the stop loss is to minimize the negative impact to the trading strategy performance that the stop loss may have, while minimizing the risk of a large loss in account equity during times of extreme volatility.

In Sample Results

As previously mentioned, a base scenario was run with no portfolio stop loss, and then tests were run with stop loss values ranging from 2%-7% in 1% increments. The table below shows the results for the in-sample tests with the test metrics explained below the table.

 

 

Baseline

7%

6%

5%

4%

3%

2%

Net Gain

$822,725

$822,725

$822,725

$840,035

$611,559

$436,065

$522,772

Total Return

82.27%

82.27%

82.27%

84.00%

61.16%

43.61%

52.28%

Profit Factor

1.44

1.44

1.44

1.44

1.34

1.24

1.29

Max Draw %

-16.40%

-16.40%

-16.40%

-14.86%

-15.54%

-12.50%

-13.83%

Return/Max Draw

3.93

3.93

3.93

4.01

3.20

2.60

3.10

GTP Ratio

2.02

2.02

2.02

2.02

1.73

1.03

1.31

Worst Day

-4.69%

-4.69%

-4.69%

-5.17%

-4.71%

-3.62%

-3.13%

Best Day

7.87%

7.87%

7.87%

7.81%

7.61%

7.88%

6.44%

Stop Loss Days

0

0

0

2

6

14

31

Table 1: In-Sample Test Results

 

Net Gain: The profit earned by the trading strategy during the in-sample period.

Total Return:: The strategy’s % return during the test period.

Profit Factor: Gross Profit divided by Gross Loss

Max Draw %: The maximum drawdown experienced by the strategy.

Return/Max Draw: The total return divided by the maximum drawdown. This is a good measure of risk adjusted return.

GTP Ratio: Gain-To-Pain ratio. This performance metric was developed by Jack Schwager and is also a good measurement of risk adjusted return. The GTP ratio is calculated by dividing the sum of the monthly returns by the sum of the returns for months that had a negative return. This the effect of penalizing strategy volatility to the downside, but not upside volatility.

Worst Day: Strategy return on the worst day over the test period.

Best Day: Strategy return on the best day during the test period.

Stop Loss Days: The number of times the portfolio stop loss was be triggered.

 

 

Some metrics were charted across all stop loss values to help decide where an appropriate stop loss value may be.

 

clip_image002

 

clip_image004

 

clip_image006

 

clip_image008

 

 

Based on the results, the strategy’s performance begins to suffer with anything greater than a 5% stop loss amount. Results for stop loss values of 5% or greater are static as there were not any days with more than a 5% loss. The value for worst day is greater than the stop amount in some cases, as in the

-4.71% maximum loss with a 4% stop due to positions due to slippage. A 5% stop loss will be selected as it will help protect the account equity from the -9% day with the least impact to the trading results based on the in sample testing.

Out of Sample Tests

 

Out of Sample tests were run from 8/2010 – 4/2014 to see how the various stop levels performed moving forward. The results of those tests are below.

 

 

Baseline

7%

6%

5%

4%

3%

2%

Net Gain

$1,078,592

$1,065,662

$1,078,578

$1,082,004

$1,062,804

$916,433

$333,811

Total Return

107.86%

106.56%

107.86%

108.20%

106.28%

91.64%

33.38%

Profit Factor

1.36

1.36

1.36

1.37

1.35

1.32

1.14

Max
Draw %

-17.45%

-17.45%

-17.45%

-18.68%

-16.32%

-15.64%

-16.00%

Return/Max Draw

3.06

3.08

3.06

3.07

2.89

2.82

1.23

GTP Ratio

1.56

1.59

1.63

1.76

1.64

1.54

0.62

Worst Day

-10.42%

-7.32%

-6.30%

-5.78%

-4.58%

-3.60%

-3.45%

Best Day

8.34%

8.34%

8.34%

8.34%

8.34%

8.34%

8.40%

Stop
Loss Days

0

1

3

3

4

8

43

Table 2: Out of Sample Results

 

 

 

clip_image010

 

clip_image012

 

clip_image014

 

clip_image016

 

Based on these result, the 5% stop loss continues to perform well in all areas, except for strategy drawdown where it is the worst of all stop loss values. This however is made up for by the fact that the total system return is the greatest out of all the stop loss values, which means that the ratio of the total return to max drawdown is comparable with values greater than 5%.

Conclusion

Moving forward, a daily portfolio stop loss will be implemented at the 5% level. If account equity drops by 5% since the previous day, then all positions will be exited. Further studies could be done to see if improvements can be made to this strategy, such as only closing unprofitable positions, or closing some, but not all positions in specific sectors, depending on how the overall sector is performing.

 

twitter: @LimitUpTrading
twitter: @RobTerp





Limiting Trading Strategy Drawdowns with an Equity Curve Filter

6 11 2012

In an effort to limit the drawdown of a trading system I like to employ a filter on the strategy’s equity curve.  Meaning that if the strategy runs into a rough period I have a set of objective rules that tells me when I should take the strategy offline. 

The most common type of filter I employ for the equity curve is based off of a 100 trade moving average of the curve.  When the equity curve is trending above the average the system remains active, when the equity curve drops below its average the system is taken offline until the curve turns upward again. 

I typically trade mean-reversion type strategies which have a  typical trade distribution with many small winning trades with the occasion large loss. The trades are also short in duration with anywhere from 3-12 trades per day placed by each strategy.  Its after a string of large losses occurs that the curve will drop below its moving average.  This type of filter would not work with a typical trend following strategy which would have many small losses and the occasional large win as the filter would likely take the strategy offline before it has a chance to place one of its few winning trades.

Below is the equity curve of the AUD/NZD strategy which I have been trading for much of the year along with its 100 trade moving average.  Recently the strategy has experienced a drawdown which erased nearly all the gains that had been earned through the year. The goal is to attempt to reduce the severity of the drawdowns. 

 

image

 

 

If the strategy is turned off when the equity curve drops below its 100 trade moving average we end up with the following result. As can be seen, when the strategy is in an uptrend the filtered equity curve provides a slight drag on profitability.  But once the equity curve takes a noticeable downward turn

 

image

 

 

Just so we’re comparing apples to apples, the stats for the unfiltered strategy will start at trade 100 (which is where the 100 trade MA starts).  The moving average filter cuts nearly half the trades out over the time period, reducing the drawdown by nearly 50%, as well as increasing the system profit by 37%. 

  Original Filtered
Trades 432 226
Avg. Trade (Ticks) +0.31 +0.83
Total Profit (Ticks) +135.7 +186.8
Max Drawdown (Ticks) -443.6 -226.90

 

In theory one could apply any number of technical indicators to a strategies equity curve in an effort to help improve its profitability, as well as to make a determination if a strategy has stopped working and should no longer be traded.  I also blogged in the past about tracking the overall equity curve of a trading account which is trading a portfolio of strategies and move excess funds into and out of the account.

http://limituptrading.wordpress.com/2011/04/16/surfing-the-equity-curve/

I am continuing research on this topic and will be exploring other possible means for determining when a strategy should be disabled or should be removed from a portfolio all together.

 

twitter: @LimitUpTrading
twitter: @RobTerp





Weekly Update 9/30/12: Live Trading AUD/NZD with the Arb Trader Application & Update on New Features

10 10 2012

I’m a few weeks behind on updating the results of the strategy as I prepared a presentation for the JavaOne conference which took place this past week.  In the meantime, the AUD/NZD version of the strategy has taken a serious beating, erasing almost all the gains since the system started trading in March. The strategy was also stopped out during the week when it hit its 100 pip stop loss.  When this event happens all other strategies will cease trading as well (EUR/DKK), until manually started again.  This is to ensure that some crazy event doesn’t take all the other strategies down with it.

This week’s number are below. All results include commission.


Week of 9/30/12

AUD/NZD EUR/DKK
# of Trades 18 14
Winning Trades 61.1% 85.7%
Avg. Trade (Ticks) -10.33 +1.18
Total Profit/Loss (Ticks) -185.9 +16.5


Total since inception

AUD/NZD* EUR/DKK**
# of Trades 485 156
Winning Trades 77.3% 87.8%
Avg. Trade (Ticks) +0.04 +0.79
Total Profit/Loss (Ticks) +20.3 +123.7

* 3/11/12
** 7/22/12

Due to the large drawdown that the AUD/NZD strategy is experiencing, I have implemented an equity curve filter on the strategy so that it remains out of the market until performance improves.  An equity curve filter takes the average cumulative gain/loss over the last 100 trades, and compares it to the current gain/loss amount of the strategy.  If the current amount is less than the average, then the system stays out of the market.  Below is a chart showing the current equity curve in blue, and the 100 trade average in red.  The y-axis units are number of ticks the strategy has made/lost.  As you can see the current equity curve in blue has fallen well below its 100 trade average.

 

image

 

Update on Progress of the Arb Trader Application


Currency Strategy

Upcoming bug fixes and new features

  • ArbTrader now has the ability to add multiple accounts and data providers, whereas previously, everything was hardcoded.
  • A JavaFX chart component now has been added to the application, which I will be adding the graph (above) to the AUD/NZD strategy tab.

End-of-Day ETF arb strategy

No updates are planned for this strategy this week.

Intraday ETF arb strategy

  • Continue monitoring 4 pairs in the paper trade account.

Twitter: @LimitUpTrading
Twitter: @RobTerp





Weekly Update 9/9/12: Live Trading AUD/NZD with the Arb Trader Application & Update on New Features

21 09 2012

Once again, I’m running a week behind on publishing the results of last week’s trading..
Both strategies had a down week, with AUD/NZD continuing its losing streak with a 10 tick loss, and EUR/DKK snapping its winning streak with an 18 tick loss for the week. As a result of the AUD/NZD losses, I’ve pared back its position sizes by nearly half until I can add a filter that will keep the system out of the market when conditions are not favorable.

This week’s number are below. All results include commission.


Week of 9/9/12

  AUD/NZD EUR/DKK
# of Trades 18 12
Winning Trades 77.8% 75.0%
Avg. Trade (Ticks) -0.57 -1.48
Total Profit/Loss (Ticks) -10.3 -17.8


Total since inception

  AUD/NZD* EUR/DKK**
# of Trades 448 127
Winning Trades 78.3% 88.1%
Avg. Trade (Ticks) +0.45 +0.80
Total Profit/Loss (Ticks) +203.1 +101.3

* 3/11/12
** 7/22/12

Update on Progress of the Arb Trader Application


Currency Strategy

Upcoming bug fixes and new features

  • Add ability to configure multiple IB accounts and new currency pairs rather than having to hard code them in the application
  • Look at implementing an equity curve filter so that when the system encounters a large string of losses the system will be switched off until the equity curve reestablishes an upward climb.

End-of-Day ETF arb strategy

No updates are planned for this strategy this week.

Intraday ETF arb strategy

  • Continue monitoring 4 pairs in the paper trade account.

 

Twitter: @LimitUpTrading
Twitter: @RobTerp





Weekly Update 9/2/12: Live Trading AUD/NZD with the Arb Trader Application & Update on New Features

14 09 2012

I’m running a little behind on publishing the results of last week’s trading once again. AUD/NZD had another another losing week dropping about 20 ticks while EUR/DKK had another strong week adding 23 ticks.

This week’s number are below. All results include commission.


Week of 9/2/12

  AUD/NZD EUR/DKK
# of Trades 21 20
Winning Trades 76.2% 95.0%
Avg. Trade (Ticks) -0.97 +1.16
Total Profit/Loss (Ticks) -20.4 +23.2


Total since inception

  AUD/NZD* EUR/DKK**
# of Trades 430 115
Winning Trades 78.3% 89.6%
Avg. Trade (Ticks) +049 +1.04
Total Profit/Loss (Ticks) +213.4 +119.1

* 3/11/12
** 7/22/12

Update on Progress of the Arb Trader Application


Currency Strategy

Upcoming bug fixes and new features

  • Add ability to configure multiple IB accounts and new currency pairs rather than having to hard code them in the application
  • I will begin work with revamping the user interface for this strategy which will include adding some JavaFX components including real-time charts.
  • Look at implementing an equity curve filter so that when the system encounters a large string of losses the system will be switched off until the equity curve reestablishes an upward climb.

End-of-Day ETF arb strategy

No updates are planned for this strategy this week.

Intraday ETF arb strategy

  • Continue monitoring 4 pairs in the paper trade account.

Twitter: @LimitUpTrading
Twitter: @RobTerp





Issues with Interactive Brokers bracket orders

13 09 2012

My software for the AUD/NZD strategy has been trading along without any issues and an event with Interactive Brokers left me with a large position without a stop loss order as a fallback.

My strategy will enter the market with a limit order, which at the time the order is submitted the software attaches a profit target limit order, a stop loss order and a good-after-time market order to exit the position if the profit target or stop loss order hasn’t been hit in a specified amount of time.

Last night I received a partial fill on the initial entry order and then the price moved up and the profit target was hit.  IB adjusted the bracket orders to reflect this partial fill as expected.  However when the price moved down again and the remaining amount was filled on the initial limit entry order, IB canceled my stop loss and my good-after-time market order, leaving only the profit target order intact and also leaving the position completely exposed if the price continued to decline.

 

I received the following email from IB below:

IBEmail

 

I’ve submitted an order ticket to IB asking them if there was a problem with the parent/child orders, why on earth would they only cancel some of the child orders and not all parent/child orders that were part of the OCA group.





Weekly Update 8/26/12: Live Trading AUD/NZD with the Arb Trader Application & Update on New Features

7 09 2012

I’m running a little behind on publishing the results of last week’s trading.  AUD/NZD had another rough week this week with a loss of nearly 95 ticks.  USD/SGD and HKD/JPY both had small losses for the week and will be dropped from trading beginning this week.  EUR/DKK had another great week with a gain of 36.7 ticks.

This week’s number are below. All results include commission.


Week of 8/26/12

  AUD/NZD USD/SGD HKD/JPY EUR/DKK
# of Trades 14 12 14 24
Winning Trades 71.4% 83.3% 71.4% 91.7%
Avg. Trade (Ticks) -6.74 -1.03 -0.01 +1.53
Total Profit/Loss (Ticks) -94.3 -12.3 -0.1 +36.7


Total since inception

  AUD/NZD* USD/SGD** HKD/JPY** EUR/DKK**
# of Trades 401 97 76 95
Winning Trades 78.5% 79.4% 75.0% 88.4%
Avg. Trade (Ticks) +0.57 -0.72 -0.01 +1.01
Total Profit/Loss (Ticks) +233.8 -69.8 -7.6 +95.9

* 3/11/12
** 7/22/12

Update on Progress of the Arb Trader Application


Currency Strategy

This week I will be working on the following bug fixes

  • . USD/SGD and HKY/JPY will be dropped from trading
  • I will begin work with revamping the user interface for this strategy which will include adding some JavaFX components including real-time charts.
  • Look at implementing an equity curve filter so that when the system encounters a large string of losses the system will be switched off until the equity curve reestablishes an upward climb.

End-of-Day ETF arb strategy

No updates are planned for this strategy this week.

Intraday ETF arb strategy

  • Continue monitoring 4 pairs in the paper trade account.

 

Twitter: @LimitUpTrading
Twitter: @RobTerp





Weekly Update 8/19/12: Live Trading AUD/NZD with the Arb Trader Application & Update on New Features

27 08 2012

As mentioned in a previous post, issues with the IB Gateway this week caused the system to miss about 3 trading opportunities that would have proved to be profitable early Thursday morning.  Regardless however both the EUR/DKK and AUD/NZD strategies had a great week, tallying up 30.5 and 59.2 ticks respectively, while the  USD/SGD had a rough week with a loss of about 30 ticks.

This week’s number are below. All results include commission.


Week of 8/19/12

AUD/NZD USD/SGD HKD/JPY EUR/DKK
# of Trades 19 18 15 17
Winning Trades 94.7% 77.8% 80.0% 94.1%
Avg. Trade (Ticks) +3.12 -1.69 -0.26 +1.79
Total Profit/Loss (Ticks) -59.2 -30.5 -3.90 +30.5


Total since inception

AUD/NZD* USD/SGD** HKD/JPY** EUR/DKK**
# of Trades 395 85 62 71
Winning Trades 78.7% 78.8% 75.8% 87.3%
Avg. Trade (Ticks) +0.83 -0.68 -0.12 +0.83
Total Profit/Loss (Ticks) +328.1 -57.5 -7.50 +59.2

* 3/11/12
** 7/22/12

 

Update on Progress of the Arb Trader Application


Currency Strategy

This week I will be working on the following bug fixes

  • . This will likely be the last week that the USD/SGD pair is traded.  Historical backtest results weren’t great, but I wanted to see how the pair performed in actual trading.  Live trading results look to be about in line with backtest results
  • I will begin work with revamping the user interface for this strategy which will include adding some JavaFX components including real-time charts

End-of-Day ETF arb strategy

No updates are planned for this strategy this week.

 

Intraday ETF arb strategy

  • I will be adding an additional 2 pairs to this strategy running in the paper trade account.

 

Twitter: @LimitUpTrading
Twitter: @RobTerp





More Issues with Interactive Brokers Gateway

25 08 2012

Another issue occurred this week with the Interactive Brokers Gateway application which is not leaving me with warm fuzzy feelings.  I awoke on Thursday morning to find the Gateway in the following state.

 

IBGatewayScreenShot

 

Apparently the Gateway disconnected from the Interactive Brokers server sometime around 1am PDT on Thursday for an unknown reason.  However, upon attempting to reconnect the Timeout Exception (above) was thrown and the Gateway didn’t attempt to reconnect again.  I also had 2 instances of Trader Workstation (TWS) running on my machine as well overnight, and they had no issues and were receiving market data as normal when I logged in, in the morning.

After closing the error dialog, the Gateway prompted for my username and password and then the security code.  After this step however the Gateway still remained in a disconnected state until I shut it down and launched it again. 

At this point I’m wondering if there is any real advantage to running my automated trading application through the Gateway vs. through an instance of TWS.  I thought that the Gateway would probably be a little lighter weight and consume less resources, but I’m inclined to switch back over to using TWS instead and IBControler to keep it running continuously through the entire week.

I’ll be opening a help ticket with IB support, but I don’t anticipate any meaningful resolution on this.





Weekly Update 8/12/12: Live Trading AUD/NZD with the Arb Trader Application & Update on New Features

20 08 2012

This past week was mixed with the AUD/NZD strategy taking the biggest hit with a loss of -60 ticks.  HKD/JPY and USD/SGD edge out a few ticks of profit and the EUR/DKK pair had a solid week with a gain of more than 14 ticks.

This week’s number are below. All results include commission.


Week of 8/12/12

AUD/NZD USD/SGD HKD/JPY EUR/DKK
# of Trades 17 12 5 11
Winning Trades 82.4% 83.3% 100.0% 91.0%
Avg. Trade (Ticks) -3.53 +0.25 +0.61 +0.91
Total Profit/Loss (Ticks) -60.0 +3.0 +3.1 +14.6


Total since inception

AUD/NZD* USD/SGD** HKD/JPY** EUR/DKK**
# of Trades 376 67 47 54
Winning Trades 77.9% 79.1% 74.5% 85.2%
Avg. Trade (Ticks) +0.71 -0.40 -0.08 +0.53
Total Profit/Loss (Ticks) +268.9 -27.0 -3.6 +28.7

* 3/11/12
** 7/22/12

 

Update on Progress of the Arb Trader Application


Currency Strategy

This week I will be working on the following bug fixes/features

  • Issue with ArbTrader’s real-time bar engine firing events a few seconds too early has been fixed and deployed to production this week.  This bug was causing “duplicate order ID” errors, which in turn was preventing entry orders from being submitted to TWS.
  • Ability to dynamically create new connection to a quote data source.  Currently the app is hard coded to talk to either my live or paper trade account and needs to be recompiled when switching between the two.

End-of-Day ETF arb strategy

No updates are planned for this strategy this week.

 

Intraday ETF arb strategy

  • This week will continue testing and collecting data for 3 pairs.
  • Develop a method to filter data spikes in order to generate reliable trading signals.  I’ve noticed some occasional spikes in the bid and/or ask, which, when the strategy places an order, it isn’t getting filled at those prices.  The ArbTrader needs a way to filter this data in order to generate signals which have a higher probability of profit.

Twitter: @LimitUpTrading
Twitter: @RobTerp








Follow

Get every new post delivered to your Inbox.