NEW: Real-time data in Trading Tools
Connect now

Backtesting

Tuesday, July 9th 2019

How to Backtest Exiting a Spread When One of the Legs Goes In-The-Money

Backtest exiting an options trade whenever any leg reaches a delta or percentage out-of-the-money. A case study example here of a put butterfly is shown.

Free Trial
Get a free trial of ORATS trading tools by completing this quiz
Take the quiz

Summary

The ORATS Backtester can exit an options trade whenever any leg reaches a delta or percentage out-of-the-money. The 'Exit Leg on Strike Trigger' can be used to control any leg of the spread. The optimizer can be used to run variations of the strategy and results can be filtered and sorted to find the best strategy. A case study example of a put butterfly is shown.

The ORATS Backtester can exit an options trade whenever any leg reaches a delta or percentage out-of-the-money.

Here's how to set this up based on this user's question:

I’m back-testing a put broken wing fly, where leg 1 is atm, leg 2 is 5% otm, and leg 3 is 15% otm. I’m trying to add an exit condition where if market closes below the short strike (i.e. 5% below where the trade started in this example), the position is closed and a new one is entered. How do I code this exit condition to exit when the middle leg of the fly (which starts as an out of the money put with perhaps a -.35 delta) goes in the money?

Use the ‘Exit Leg on Strike Trigger’ to control any leg of the spread.

Here you would set a max stockOTMpct of 1 as the exit trigger.

 

With the Exit Leg on Strike Trigger you can use the dropdown to select any leg (here leg 2 exit if the percent OTM goes above the max of 100%) and use the '+' button to add more legs.

Here's how to set up the strike selection for this strategy.

 

Next steps? Try the optimizer for this strategy.

Run a few more variations of the strategy. Here I varied the days to expiration, OTM percentage, and spread yield percentage. When the backtests have completed, click on the boxes to the left of each description. The 'Optimize' button will appear. Click that and all the variations will be run with each other and the results returned in a sortable and filterable table.

 

I filtered the table by Worst Month Return greater than 4% and sorted the table by Sharpe Ratio.

 

The top strategy has 90 DTE, 85% / 95% / 100% OTM strike percentages for the put butterfly legs, and a spread yield target of 0% with min of collecting -0.5% and max of paying +0.5% for the fly.

 

 

 

 

Disclaimer:

The opinions and ideas presented herein are for informational and educational purposes only and should not be construed to represent trading or investment advice tailored to your investment objectives. You should not rely solely on any content herein and we strongly encourage you to discuss any trades or investments with your broker or investment adviser, prior to execution. None of the information contained herein constitutes a recommendation that any particular security, portfolio, transaction, or investment strategy is suitable for any specific person. Option trading and investing involves risk and is not suitable for all investors.

All opinions are based upon information and systems considered reliable, but we do not warrant the completeness or accuracy, and such information should not be relied upon as such. We are under no obligation to update or correct any information herein. All statements and opinions are subject to change without notice.

Past performance is not indicative of future results. We do not, will not and cannot guarantee any specific outcome or profit. All traders and investors must be aware of the real risk of loss in following any strategy or investment discussed herein.

Owners, employees, directors, shareholders, officers, agents or representatives of ORATS may have interests or positions in securities of any company profiled herein. Specifically, such individuals or entities may buy or sell positions, and may or may not follow the information provided herein. Some or all of the positions may have been acquired prior to the publication of such information, and such positions may increase or decrease at any time. Any opinions expressed and/or information are statements of judgment as of the date of publication only.

Day trading, short term trading, options trading, and futures trading are extremely risky undertakings. They generally are not appropriate for someone with limited capital, little or no trading experience, and/ or a low tolerance for risk. Never execute a trade unless you can afford to and are prepared to lose your entire investment. In addition, certain trades may result in a loss greater than your entire investment. Always perform your own due diligence and, as appropriate, make informed decisions with the help of a licensed financial professional.

Commissions, fees and other costs associated with investing or trading may vary from broker to broker. All investors and traders are advised to speak with their stock broker or investment adviser about these costs. Be aware that certain trades that may be profitable for some may not be profitable for others, after taking into account these costs. In certain markets, investors and traders may not always be able to buy or sell a position at the price discussed, and consequently not be able to take advantage of certain trades discussed herein.

Be sure to read the OCCs Characteristics and Risks of Standardized Options to learn more about options trading.

Free Trial
Get a free trial of ORATS trading tools by completing this quiz
Take the quiz
Contact Us
Questions about the API requirements? Want to become an affiliate? Curious about the backtester? Leave us a message and we'll get back to you shortly.
Your email
Your message
Submit
ORATS University
ORATS University
Master the art of options
Research
Implementation
Risk
Review
The opinions and ideas presented herein are for informational and educational purposes only and should not be construed to represent trading or investment advice tailored to your investment objectives. You should not rely solely on any content herein and we strongly encourage you to discuss any trades or investments with your broker or investment adviser, prior to execution. None of the information contained herein constitutes a recommendation that any particular security, portfolio, transaction, or investment strategy is suitable for any specific person. Option trading and investing involves risk and is not suitable for all investors. For more information please see our disclaimer.
Interactive Brokers is not affiliated with Option Research & Technology Services, LLC and does not endorse or recommend any information or advice provided by Option Research & Technology Services, LLC.