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.

null

 

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.

null

 

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.

null

 

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

null

 

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.

null
 

Get started with the backtester today with a free trial.

 

 

 

related posts

New Backtest Feature: Enter Trades Based on Premium Divided by Strike Difference
Aug
07
Backtesting, options trading, put spread, vertical

New Backtest Feature: Enter Trades Based on Premium Divided by Strike Difference

For spread strategies, you can now define the premium compared to the strike difference for...

Read Post
The Tale of Two Backtests: Why Aren't Opposite Strategies Absolute Returns Equal?
Aug
06
Backtesting, Pairs Trading, options trading, slippage, commission

The Tale of Two Backtests: Why Aren't Opposite Strategies Absolute Returns Equal?

You might think a strategies like short call spreads and long call spreads should have equal and...

Read Post

We're here, if you need us.

Still curious how we can help you?




LET'S CHAT