CustomMenu

Thursday, December 22, 2016

38 DTE Iron Condor Results Summary

The introduction to this series, here, described the different variations of SPX iron condors (IC) and exits that were tested at 38 days to expiration (DTE).  Recall, the tests covered 9 IC variations, with short strike deltas at four locations, utilizing 12 exits.  In all, there were 432 test runs (9 variations x 4 deltas x 12 exits). Each test run executed more than 200 SPX IC trades between the Jan-2007 expiration and the Sep-2016 expiration.  I used weekly options for this testing, so there were more than 12 trades per year.  In total, there were 97,416 total trades entered for the 38 DTE testing.

There are six groupings of charts below, with each grouping containing 12 charts.  Each row corresponds to a short delta (row 1 = 8 delta, row 2 = 12 delta, row 3 = 16 delta, row 4 = 20 delta), and each column corresponds to an IC wing width (column 1 = 25 points, column 2 = 50 points, column 3 = 75 points).

Each of the charts contains data for the 12 exits for each of the three primary IC structures (standard balanced - ST, extra long put - EL, delta neutral - DN).

All of the charts are structured similarly:
  • Each colored line in a chart represents a particular type of IC structure:
    • Blue lines are for standard balanced ICs (ST)
    • Red lines are for extra long put ICs (EL)
    • Green lines are for delta neutral ICs (DN)
  • The lines styles are associated with a particular profit taking approach:
    • Solid lines represent profit taking at 50% of the credit received
    • Dashed lines represent profit taking at 75% of the credit received
    • Dotted lines represent closing the trade at 2 DTE with no profit taking target (NA)
  • The X-axis displays the loss taking percentage level in terms of the credit received:
    • 100%, 200%, 300%, and no loss taking level / closing at 2 DTE (NA)

Normalized P&L per Day

This first set of charts shows normalized P&L Per Day percentages.  A couple of notes on these charts:
  • The Y-axis scale is the same for all the P&L per day charts in this blog post
  • The Y-axis displays the average normalized percent P&L per day
  • Each of the 432 test runs is represented in the 12 charts below, and each test run had a different average days-in-trade (DIT).  The number DIT obviously impacts the average P&L per day
  • The max risk for a 25 point 8 delta IC will be approximately half the max risk for a 50 point 8 delta IC.  The P&L per day values are expressed as a percentage of the max risk for that test run...this is necessary in order to fairly compare the returns of each of the different wing widths
A couple of trends are clear:
  1. There is more variability in P&L per day readings in the 25 point wing width ICs
  2. As the delta of the short strikes increases, the variability in the P&L per day readings increases
  3. The largest reading was 0.18% and was associated with the ST (100:50), 50 point wings, 20 delta
  4. The next best reading was 0.17% and was associated with three test runs: 
    1. ST (100:50), 25 point wings, 20 delta
    2. ST (100:75), 25 point wings, 16 delta
    3. DN(100:50), 25 point wings, 20 delta
(click to enlarge)


Normalized P&L per Trade

The normalized P&L per trade charts are organized in the same way as the normalized P&L per day charts.  Also note that these returns are expressed as a percentage of the max risk for a particular test run.  There were 432 test runs, with each test run including 200+ trades.  In a test run, the $ returns for each of these trades varied slightly, as well as the $ max risk for each of these trades.  The $ returns were averaged, and this $ average was divided by the largest $ max risk for all of the 200+ trades in that run.  This is the normalized P&L for that test run...with all 432 of these data points displayed in the 12 charts below.

We see the following in the data:
  1. We can see that the variability in normalized P&L per trade again increases as the delta of the short strike increases, and decreases with increasing wing width.
  2. The largest normalized P&L per trade was 4.3% for the ST (200:75), 25 point wings, 16 delta
  3. The top four P&L per trade variations were all associated with profit taking at 75%, wing widths of 25 points, and short strike deltas of 16
  4. The top P&L per day variations came in the following positions in terms of P&L per trade:
    1. ST (100:50), 50 point wings, 20 delta came in 7th place -> 3.4%
    2. ST (100:50), 25 point wings, 20 delta came in 11th place -> 3.4%
    3. ST (100:75), 25 point wings, 16 delta came in 2nd place -> 4.1%
    4. DN(100:50), 25 point wings, 20 delta came in 5th place -> 3.5%
(click to enlarge)


Win Rate

The chart structure should be familiar to you by now, so I'll not review the chart layouts.  The win rate trends are clear:
  1. Win rates tend to increase as wing widths increase
  2. Win rates tend to increase as the delta of the short strike decreases
  3. The top win rate was 92%, and was associated with these five strategies:
    1. DN (NA:50), wing width 75, 8 delta
    2. DN (NA:50), wing width 50, 8 delta
    3. ST (NA:50), wing width 50, 8 delta
    4. ST (NA:50), wing width 75, 8 delta
    5. DN (NA:50), wing width 25, 8 delta
  4. The top 10 strategies all had win rates of 91% or better...and all 10 had two variables in common...they took profits at 50%, and none of them used loss exits (they exited at 2 DTE).  8 of these 10 also had short strike deltas of 8.
(click to enlarge)


Largest Loss

The next charts show the normalized largest loss for each of the test runs  These largest losses are expressed as a percentage of the max defined risk number for all of the 200+ trades in a test run.  Here are the trends:
  1. The largest loss percentage increases with increasing short strike delta
  2. The largest loss percentage increases with increasing loss taking level...surprise! :)
  3. The top 24 largest losses all occurred with strategies with 25 point wing widths, and had losses of 95% or greater
  4. The top 4 smallest losses all occurred with strategies with 75 point wing widths and 8 delta short strikes:
    1. DN (100:50), 75 point wings, 8 delta -> 15% loss
    2. DN (100:75), 75 point wings, 8 delta -> 15% loss
    3. ST (100:50), 75 point wings, 8 delta ->15% loss
    4. ST (100:75), 75 point wings, 8 delta -> 15% loss
(click to enlarge)


Profit Factor

The best 15 profit factors were associated with delta neutral trades with 8 delta short strikes.  The top performers were:
  1. DN (NA:NA), 75 point wings, 8 delta -> 2.0
  2. DN (NA:75), 50 point wings, 8 delta -> 1.9
  3. DN (NA:75), 75 point wings, 8 delta -> 1.9
  4. DN (NA:NA), 50 point wings, 8 delta -> 1.9
  5. DN (300:75), 50 point wings, 8 delta -> 1.9 
(click to enlarge)


Average DIT For Winning Trades

This metric was derived by averaging all of the DIT for all of the winning trades in test run.  If you are basing your IC trading on one of the 432 variations in my backtesting, you'll want to keep an eye on these DIT numbers.  Adding a DIT exit to your profit and loss exits is worth considering.

Here are a few trends:
  1. The larger the delta of your short strikes the longer you'll need to stay in your trades
  2. The larger your profit taking level, the longer you'll need to stay in your trade...surprise! :)
  3. The 50% profit taking level should have you out of the trade in less than 20 days for a 38 DTE IC
  4. The smallest winning trade DITs were associated with 8 delta short strikes, profit taking at 50%, and loss taking at 100%...the structure type (ST, EL, DN) did not matter as seen in the charts
(click to enlarge)

A part two to this article will follow some time next week.

Follow my blog by email, RSS feed or Twitter (@DTRTrading).  All options are available on the top of the right hand navigation column under the headings "Subscribe To RSS Feed", "Follow By Email", and "Twitter"

Tuesday, December 20, 2016

New Iron Condor Series Introduction

If you've been following my Twitter feed, you know that I have started analyzing Iron Condors (IC) again. I am looking at the same three structures that I've looked at in past posts (standard balanced IC, delta neutral IC, and extra long put IC), but with varying wing widths.  Part of the motivation here is to see if we can get close to short strangle returns, but with defined risk. 

In the screen shots below, are examples of these three structures, with the three different wing widths that will be reviewed (25 point, 50 point, and 75 point).   These screen shots were taken after market close on Monday, December 19th, using the SPX 17-Feb-2017 expiration at 59 DTE.  The standard balanced ICs are all 10 contracts / 10 lot.  The delta neutral IC and extra long put IC modify this 10 lot structure as shown below.


Standard Balanced Iron Condor (ST)
  • 25 point wing width 
    • Strikes: 2415 / 2390 / 2045 / 2020
    • Short Delta: 8 
    • Credit: $2,100
    • Max Risk: $22,850
59 DTE SPX standard balanced iron condor with 8 delta short strikes and 25 point wings
(click to enlarge)

  • 50 point wing width 
    • Strikes: 2440 / 2390 / 2045 / 1995
    • Short Delta: 8 
    • Credit: $3,600
    • Max Risk: $46,400
59 DTE SPX standard balanced iron condor with 8 delta short strikes and 50 point wings
(click to enlarge)

  • 75 point wing width
    • Strikes: 2465 / 2390 / 2045 / 1970
    • Short Delta: 8
    • Credit: $4,700
    • Max Risk: $70,300
59 DTE SPX standard balanced iron condor with 8 delta short strikes and 75 point wings
(click to enlarge)



Extra Long Put Iron Condor (EL)
  • 25 point wing width
    • Strikes: 2415 / 2390 / 2045 / 2020
    • Short Delta: 8
    • Credit: $1,565
    • Max Risk: $23,435
59 DTE SPX extra long put iron condor with 8 delta short strikes and 25 point wings
(click to enlarge)

  • 50 point wing width
    • Strikes: 2440 / 2390 / 2045 / 1995
    • Short Delta: 8
    • Credit: $3,145
    • Max Risk: $46,855
59 DTE SPX extra long put iron condor with 8 delta short strikes and 50 point wings
(click to enlarge)

  • 75 point wing width
    • Strikes: 2465 / 2390 / 2045 / 1970
    • Short Delta: 8
    • Credit: $4,340
    • Max Risk: $70,660
59 DTE SPX extra long put iron condor with 8 delta short strikes and 75 point wings
(click to enlarge)



Delta Neutral Iron Condor (DN)
  • 25 point wing width
    • Strikes: 2415 / 2390 / 2045 / 2020
    • Short Delta: 8
    • Credit: $1,525
    • Max Risk: $23,475
59 DTE SPX delta neutral iron condor with 8 delta short strikes and 25 point wings
(click to enlarge)

  • 50 point wing width
    • Strikes: 2440 / 2390 / 2045 / 1995
    • Short Delta: 8
    • Credit: $2,675
    • Max Risk: $47,325
59 DTE SPX delta neutral iron condor with 8 delta short strikes and 50 point wings
(click to enlarge)

  • 75 point wing width
    • Strikes: 2465 / 2390 / 2045 / 1970
    • Short Delta: 8
    • Credit: $3,575
    • Max Risk: $71,425
59 DTE SPX delta neutral iron condor with 8 delta short strikes and 75 point wings
(click to enlarge)

Over the next several months I will review how these 9 IC variations have performed between the Jan-2007 expiration and the Sep-2016 expiration on the SPX.  Unlike past tests, in this series, I will include weekly options.  This will provide more trade occurrences, thus resulting in more meaningful metrics.

I will look at four different short strike deltas (8, 12, 16, and 20), across several DTE (38, 45, 52, 59, 66, 73, and 80) for the 9 IC variations above.

The following 12 exits will be tested for each of the 9 variations at each delta, for each DTE:
  1. NA:NA - exit at 2 DTE.
  2. NA:50 - exit if the trade has a profit of 50% of its initial credit OR 2 DTE.
  3. NA:75 - exit if the trade has a profit of 75% of its initial credit OR 2 DTE.
  4. 100:NA - exit if the trade has a loss of 100% of its initial credit OR 2 DTE.
  5. 100:50 - exit if the trade has a loss of 100% of its initial credit OR if the trade has a profit of 50% of its initial credit OR 2 DTE.
  6. 100:75 - exit if the trade has a loss of 100% of its initial credit OR if the trade has a profit of 75% of its initial credit OR 2 DTE.
  7. 200:NA - exit if the trade has a loss of 200% of its initial credit OR 2 DTE.
  8. 200:50 - exit if the trade has a loss of 200% of its initial credit OR if the trade has a profit of 50% of its initial credit OR 2 DTE.
  9. 200:75 - exit if the trade has a loss of 200% of its initial credit OR if the trade has a profit of 75% of its initial credit OR 2 DTE.
  10. 300:NA - exit if the trade has a loss of 300% of its initial credit OR 2 DTE.
  11. 300:50 - exit if the trade has a loss of 300% of its initial credit OR if the trade has a profit of 50% of its initial credit OR 2 DTE.
  12. 300:75 - exit if the trade has a loss of 300% of its initial credit OR if the trade has a profit of 75% of its initial credit OR 2 DTE.
For a given DTE, there will be 432 test runs (9 variations x 4 deltas x 12 exits).  As mentioned earlier, each test run will enter as many trades as possible that meet the entry criteria between the Jan-2007 expiration and the Sep-2016 expiration.  For a given DTE, this will result in the backtest of approximately 100,000 trades.  This process will take some time!


Follow my blog by email, RSS feed or Twitter (@DTRTrading).  All options are available on the top of the right hand navigation column under the headings "Subscribe To RSS Feed", "Follow By Email", and "Twitter"

Wednesday, September 28, 2016

Momentum Rotation System AmiBroker Code

I've received several requests for details on the AmiBroker (AB) code and settings used for the backtest shown in my April post: Momentum Rotation 60 Day ROC System Results. That post used the AmiBroker Formula Language (AFL) code from my article in March 2015.  That was a long time ago, so here is the 60 day momentum rotation system AFL again:
SetBacktestMode( backtestRotational );

// 1 ###### BACKTESTER SETTINGS - 1. GENERAL TAB 
SetOption("InitialEquity", 100000);
SetOption("MinShares", 1);
SetOption("MinPosValue", 0);
SetOption("FuturesMode", False);
SetOption("AllowPositionShrinking", False);
SetOption("ActivateStopsImmediately", False);
SetOption("ReverseSignalForcesExit", False);
SetOption("AllowSameBarExit", False);
RoundLotSize = 0;
TickSize = 0;
MarginDeposit = 0;
PointValue = 1;
SetOption("CommissionMode", 2);
SetOption("CommissionAmount", 7.95);
SetOption("InterestRate", 0);
SetOption("AccountMargin", 100);
SetOption("MarginRequirement", 100);

// 2 ###### BACKTESTER SETTINGS - 2. TRADES TAB 
BuyPrice = SellPrice = ShortPrice = CoverPrice = Close;
SetTradeDelays( 1, 1, 1, 1);

// 5 ###### BACKTESTER SETTINGS - 5. PORTFOLIO TAB 
//SetOption("MaxOpenPositions",   1);
// check the box to "Add artificial future bar..."
// Limit trade size as % - use 10 for live trading
// check the box to "Disable trade size limit..."
SetOption("UsePrevBarEquityForPosSizing", False);
SetOption("UseCustomBacktestProc",  False);

// 6 ###### BACKTESTER SETTINGS - 6. WALK FORWARD TAB
//SetOption("WorstRankHeld",    1);


Totalpositions = 1;
SetOption("WorstRankHeld", 1);
SetOption("MaxOpenPositions", Totalpositions );
PositionSize = -100 / Totalpositions ;

LastDayOfMonth = IIf( (Month() == Ref( Month(), 1) AND (Month() != Ref( Month(), 2)) ), 1, 0);
TradeDay = LastDayOfMonth ;

Score = ROC(Close, 60);
PositionScore = IIf(Score < 0, 0, Score ); // Long only
PositionScore = IIf(TradeDay , PositionScore , scoreNoRotate);

//Exploration
Filter = 1;
AddColumn(Score ,"Score",1.1);
AddColumn(PositionScore ,"PositionScore ",1.1);
AddColumn(PositionSize ,"Position Size",1.1);
You can download the AFL code above from my Google Drive: 00_60DayMomentum.afl

It is fairly straight forward AFL code, but I've highlighted four key areas:
  • Line 1 - Rotational trading needs to be activated for this system
  • Line 24 - Trade delays are set to 1, which means trades are entered one day after the signal is generated
  • Line 43 - The LastDayOfMonth variable actually stores the second to last day of the month.  This causes the rotation ranking signal to be calculated on the second to last day of the month.  Since our trade delay is one, the trade occurs the following day, the last day of the month
  • Line 47 - If the ROC(60) is negative, then the PositionScore is set to 0, otherwise the PositionScore is set to the ROC(60)

On the second to last trading day of the month, this strategy calculates the 60 day ROC for each product in the portfolio based on closing prices on that day.  If the 60 day ROC is negative, the system sets the PositionScore to 0 for that product.  It then ranks all of the products in the portfolio, selecting the product with the highest rank.  If all products have a rank of 0, the system will move to cash.  On the last trading day of the month, it executes the buy and sell orders at the close - "market on close" orders in live trading.

In addition to the AFL code above, I used the AB settings shown below.  To replicate my results, you'll need to update your AB settings to match mine.

AmiBroker Backtester Settings - General Tab
AmiBroker Backtester Settings General Tab
(click to enlarge)

AmiBroker Backtester Settings - Trades Tab
AmiBroker Backtester Settings Trades Tab
(click to enlarge)

AmiBroker Backtester Settings - Stops Tab
AmiBroker Backtester Settings Stops Tab
(click to enlarge)

AmiBroker Backtester Settings - Report Tab
AmiBroker Backtester Settings Report Tab
(click to enlarge)

AmiBroker Backtester Settings - Portfolio Tab
AmiBroker Backtester Settings Portfolio Tab
(click to enlarge)

AmiBroker Backtester Settings - Walk Forward Tab
AmiBroker Backtester Settings Walk Forward Tab
(click to enlarge)

AmiBroker Backtester Settings - Monte Carlo Tab
AmiBroker Backtester Settings Monte Carlo Tab
(click to enlarge)

AmiBroker Backtester Filter Settings
AmiBroker Backtester Filter Settings
(click to enlarge)

To run my AFL in your installation of AmiBroker:
  • Download my AFL file
  • Open an AB Analysis tab
  • Select my AFL file in the Formula field on the Analysis tab
  • Update the filter settings (shown above) to only run this strategy against a specific Watch List
  • Change the range to "From-To dates", and then select a date range
  • Finally, select the Backtest button to run the strategy

After you have backtesting configured and running, the next step is to automate quote updates and signal generation.  I use the Windows Task Scheduler utility to call JS scripts, that in turn launch AB and AmiQuote.  This topic is beyond the scope of this article, but I may discuss it in the future.

Also, since my last blog post, there have been several articles on momentum trading, and the poor performance of these systems lately.  Here are a few worth reading:


Follow my blog by email, RSS feed or Twitter (@DTRTrading).  All options are available on the top of the right hand navigation column under the headings "Subscribe To RSS Feed", "Follow By Email", and "Twitter"