- Solve real problems with our hands-on interface
- Progress from basic puts and calls to advanced strategies
The article first appeared on ORATS blog.
You read that right – In the largest group of options backtests ever studied, Option Research and Technology Services (ORATS) recently published over 180 million options strategies spanning 100+ stocks and 11 strategies. In this article, we share exclusive insights from this massive study that will help you improve and optimize your trading strategies.
This article is divided into subtopics to help you understand backtesting in detail.
By the end of this article, you’ll have learned tips and tricks for how to limit failure and maximize success in your own backtesting journey.
Why is backtesting important?
A robust options trading strategy depends on accurate backtesting practices. A backtest shows you how the strategy performed historically, and gives you an idea of what to expect. You can learn a lot about a strategy with a backtest. While historical performance is not an indicator of future performance, a backtest can help you identify things like:
These are benefits, but there are also complications with backtesting. Let’s look at some of the common issues traders face when backtesting options.
Common pitfalls of options backtesting
Having been in the options backtesting business for over a decade, we see many traders fall into the same traps. Here, we list methods to help avoid those problems:
Choosing the right entry and exit criteria
There’s nearly an infinite amount of settings you can test when running an options backtest. Through our research, we’ve identified the most important entry criteria, technical indicators, and exit triggers so you can run your own backtest with more confidence.
Entry criteria:
It’s interesting to explore the relationships between different backtest entry criteria and their performance. For example, we found that if you filter down SPY Short Put Spreads by a low VIX entry trigger, and rank them by best overall performance, we see that the spread / stock is almost always low. This showed us that in a low volatility environment, this strategy performed better as we targeted a lower spread yield.
Technical indicators: Technical indicators can provide guidance on when to enter a trade. The following five indicators are a good starting point when assessing what to add to your backtest.
Exit Criteria: Exit triggers play a crucial role in risk management and profit protection. It’s important to test stop loss levels of -25%, -50%, and -75% to protect from excessive losses. For locking in profits, we suggest testing profit targets of +25%, +50%, +75%, +100% (if debit strategy), +150% (if debit strategy), and +300% (if debit strategy).
Measuring strategy performance
It’s important to measure the right performance metrics when backtesting, otherwise you’ll end up with a lot of data and no idea what to do with it. Before diving into the specifics, let’s outline four categories of metrics we believe are critical to analyzing performance:
Return: Metrics such as annual returns (overall, 1 year, 5 years, bearish and bullish markets), annual margin return, and best/worst monthly and annual returns.
Risk: Quantitative measurements such as Sharpe Ratio, Sortino Ratio, Annual Volatility, Max Drawdown %, Drawdown Days, and Reward to Risk Average.
Profit & Loss: Comprehensive data like average P&L % per day, best and worst trade P&L (both in dollar and percentage), average P&L per trade and per day, and total strategy P&L.
Other: Metrics including % of time in the market, strategy win rate, average days in trade, total strategy trades, credit/debit per trade average, margin per trade average, and margin to stock %.
Let’s dive deeper into some of the most important metrics:
Sharpe vs. Sortino ratio: While they might seem similar at first, each ratio offers a distinct perspective on risk and should be understood separately. The Sharpe ratio gauges how much excess return a strategy provides relative to the risk taken, using standard deviation as a proxy for risk. It’s excellent for understanding a strategy’s overall risk-adjusted return, but it falls short in one critical area – it doesn’t distinguish between upside and downside volatility. That’s where the Sortino ratio comes in. The Sortino ratio, like the Sharpe ratio, evaluates risk-adjusted return, but it only considers downside volatility. In doing so, it addresses an important asymmetry in trading – traders generally welcome upside volatility while fearing its downside counterpart. A high Sortino ratio signals that a strategy minimizes damaging losses while potentially capitalizing on desirable volatility.
Percent of time in market: The percent of time in market is an important metric in backtesting because it can help reduce overfitting. By setting a minimum filter, you can focus on backtests with a statistically sound number of market days. Imagine two strategies: Strategy A has been in the market for 300 days, and Strategy B for only 30 days. While Strategy B might show an impressive return for its short time, its performance metrics might be unreliable due to the small sample size. By filtering percent of time in market, you can prevent overfitting and enable a more robust evaluation of the strategies’ true performance. Like percent of time in market, you should consider filtering other metrics such as drawdown days, total strategy trades, and margin to stock % to fine-tune your risk tolerance and trading preferences.
Profit and loss metrics: It’s important to calculate various measures of profit and loss to provide a comprehensive view of a strategy’s performance. The best and worst trade p&l metrics make it easy to quantify your upside potential versus the downside risk of the strategy. Sometimes it’s good to filter strategies based on p&l percent per day, as that can be a good baseline for an effective strategy.
The future of backtesting
I want to end on a brief discussion about the future of backtesting. Gone are the days of tireless, manual backtesting in the form of excel sheets and poor quality data. With the availability of high quality minute-by-minute historical data and powerful cloud computing technology, traders of the future will be answering their backtesting questions in seconds with AI powered research assistants. Going from a backtest to live implementation will take no more than a single click of the mouse – seamlessly integrated into the trading lifecycle. Today, you’ve learned about the key principles of backtesting that are driving this cultural shift. Stay tuned for the next installment from ORATS to keep up with the latest trends in options trading.
You can browse all 180 million of ORATS’ backtests on their website by visiting orats.com/ib?utm_source=ib&utm_campaign=quantblog. This article was originally published on orats.com/blog.
For specific platform feedback and suggestions, please submit it directly to our team using these instructions.
If you have an account-specific question or concern, please reach out to Client Services.
We encourage you to look through our FAQs before posting. Your question may already be covered!
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.
Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.
This material is from ORATS and is being posted with its permission. The views expressed in this material are solely those of the author and/or ORATS and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.
Options involve risk and are not suitable for all investors. For information on the uses and risks of options, you can obtain a copy of the Options Clearing Corporation risk disclosure document titled Characteristics and Risks of Standardized Options by going to the following link ibkr.com/occ. Multiple leg strategies, including spreads, will incur multiple transaction costs.
If you’re backtesting an intraday strategy then you must run the data at multiple times in one day. I understand the idea of overfitting, but I don’t follow the above overfitting statement – doesn’t make sense to me.
My Goal is to execute a TradingView Strategy and have Orders sent to InteractiveBrokers: 1) Long Position = CALL Option at 1 Strike Out of The Money, Number of Contracts 2) Stop Loss 3) Trailing Stop Loss 4) Exit Long Position Signal Opposite trade: 5) Short Position = PUT Option at 1 Strike Out of The Money, Number of Contracts 2) Short Stop Loss 3) Short Trailing Stop Loss 4) Exit Short Position Signal Can this be done between TradingView and Interactive Brokers? Some code from IBKR teaching videos are given, but have not seen how a TradingView Strategy can be executed while connected to IBKR. :Python code: from ibapi.client import EClient from ibapi.wrapper import EWrapper from ibapi.contract import Contract import time import threading class TestApp(EClient, EWrapper): def __init__(self): EClient.__init__(self, self) self.orderId = 0 def nextValidId(self, orderId): self.orderId = orderId def nextId(self): self.orderId += 1 return self.orderId def error(self, reqId, errorCode, errorString, advancedOrderReject): print(f”reqId: {reqId}, errorCode: {errorCode}, errorString: {errorString}, orderReject: {advancedOrderReject}”) def contractDetails(self, reqId, contractDetails): attrs = vars(contractDetails) print(“\n”.join(f”{name}: {value}” for name, value in attrs.items())) print(contractDetails.contract) def contractDetailsEnd(self, reqId): print(“End of contract details”) self.disconnect() app = TestApp() app.connect(“127.0.0.1”, 7497, 0) threading.Thread(target=app.run).start() time.sleep(1) # ===== STOCK CONTRACT (AAPL) ===== # mycontract = Contract() # mycontract.symbol = “AAPL” # mycontract.secType = “STK” # Corrected from “SIK” # mycontract.currency = “USD” # mycontract.exchange = “SMART” # mycontract.primaryExchange = “NASDAQ” # ===== FUTURES CONTRACT (ES Aug 2025) ===== # mycontract = Contract() # mycontract.symbol = “ES” # E-mini S&P 500 futures # mycontract.secType = “FUT” # mycontract.currency = “USD” # mycontract.exchange = “CME” # mycontract.lastTradeDateOrContractMonth = “202508” # August2025 expiry # ===== OPTIONS CONTRACT (SPX Dec 2024 Put) ===== mycontract = Contract() mycontract.symbol = “SPX” # S&P 500 Index options mycontract.secType = “OPT” mycontract.currency = “USD” mycontract.exchange = “SMART” mycontract.lastTradeDateOrContractMonth = “202508” # August 2025 expiry mycontract.right = “P” # Put option (“C” for Call) mycontract.strike = 6380 # Strike price mycontract.tradingClass = “SPXW” # Weekly options (use “SPX” for standard) app.reqContractDetails(app.nextId(), mycontract) # Fixed syntax from .mycontract to , mycontract
Hello, thank you for reaching out. Based on the description, this sounds like a relatively standard set of bracket orders. Please review these Traders’ Academy courses for creating a Bracket Order and creating a trailing stop order. The rest of the code would be using reqContractDetails to find the exact strikes you are interested in.
How to create Bracket Orders in TWS API: https://www.interactivebrokers.com/campus/trading-lessons/python-complex-orders/
How to create a trailing stop order: https://www.interactivebrokers.com/campus/ibkr-api-page/order-types/#trailing-stop-order
They could be great resources for you!