We are starting this new discussion to share a powerful investment strategy inspired by What Works on Wall Street by James P. O'Shaughnessy. I highly recommend reading the book to dive into the details of quantitative investing, though we’ll summarize the main rules here for clarity.
This strategy’s simplicity and robustness aren’t widely appreciated, but when we discovered it, we realized its potential as a cornerstone for any investment portfolio. It combines value and momentum, drawing from decades of historical data to beat the market consistently.
The algorithm’s objective is to capitalize on stocks that are undervalued yet showing strong price momentum, using a universe of S&P 500 stocks (or a broader set like O'Shaughnessy's "All Stocks"). All rules are applied annually, with a disciplined rebalancing approach, unless a RISK OFF signal is triggered.
- Market Regime Filter: The S&P 500’s momentum over the last 12 months (252 trading days) is positive, ensuring we’re investing in a bullish environment. If the momentum turns negative, the indicator signals RISK OFF.
- Risk Management (Improvement): When the Market Regime Filter signals RISK OFF, we exit equities and invest in CASH (e.g., money market funds) or medium-term bonds (e.g., 5-10 year Treasuries), depending on which has the higher momentum over the last month (21 trading days). If equities are back in a RISK ON regime, we resume stock investments.
- Liquidity Filter: The stock must be among the 500 most liquid US stocks, determined monthly by the highest 200-day average dollar volume.
- Value Filter: The stock’s Price-to-Sales Ratio (PSR) must be below 1, identifying undervalued companies relative to their sales.
- Momentum Filter: The stock’s Relative Strength must rank among the top performers over the past 12 months, confirming it’s a "winner" with strong upward momentum.
- Stock Selection: Rank all qualifying stocks with PSR < 1 by their momentum, then BUY on the close, in equal weight, the 25 stocks in descending order of momentum.
- Sell Rule: SELL the stock on the close at the end of the year when the portfolio is rebalanced, sticking to a strict annual cycle, unless a RISK OFF signal prompts an earlier exit to CASH or bonds.
Benefits of a PSR & Relative Strength Strategy
This strategy leverages two proven factors: value and momentum. Stocks with a PSR < 1 are often undervalued, providing a margin of safety as they’re bought at a discount to their revenue (Chapter 8, What Works on Wall Street). Meanwhile, Relative Strength captures stocks that have already begun to outperform, capitalizing on the tendency of winners to keep winning (Chapter 15). This combination diversifies a portfolio by blending a value stream with a momentum stream, reducing correlation with pure growth or mean reversion strategies. It exploits market inefficiencies—buying undervalued stocks with strong momentum—and has historically delivered consistent returns, especially in trending markets. Our RISK OFF improvement further enhances the strategy by reducing exposure during bearish markets, preserving capital through CASH or bonds.
Backtest Results and Key Statistics
We backtested this strategy from 1998 to October 2024 to confirm its effectiveness in more recent market conditions. Below are the results of our backtest, which align with O’Shaughnessy’s historical findings:

- Compound Annual Return (CAGR): 17.412%, demonstrating strong long-term growth compared to the S&P 500’s historical average of around 10% over similar periods.
- Sharpe Ratio: 0.524, indicating a reasonable risk-adjusted return, balancing profitability with volatility.
- Drawdown: 56.500%, with the largest drawdown occurring in 2020 due to the COVID-19 crisis. This significant drop was driven by the unprecedented market crash in March 2020, which affected nearly all strategies, especially those with exposure to momentum factors like Relative Strength. However, the strategy recovered steadily as markets rebounded.

- Win Rate: 55%, with an average win of 2.29% and an average loss of -1.606%, leading to a Profit-Loss Ratio of 2.16. This shows the strategy’s ability to generate more substantial gains than losses over time.
- Net Profit: Starting with $1,000,000 in 1998, the strategy grew to $7,898,506.01 by October 2024, yielding a net profit of $7,798,506—a testament to its compounding power.
- Annual Standard Deviation: 0.242, reflecting moderate volatility, which is expected given the momentum component of the strategy.
- Alpha: 0.996, indicating significant outperformance relative to the market benchmark.
- Portfolio Turnover: 0.89%, highlighting the strategy’s low turnover due to annual rebalancing, which helps minimize transaction costs.
These results confirm that the PSR & Relative Strength strategy continues to perform well in modern markets, maintaining its edge as identified by O’Shaughnessy in his 1951-1994 tests. The elevated drawdown in 2020 underscores the importance of staying disciplined during market shocks, as the strategy’s long-term returns remain robust. Our RISK OFF improvement likely mitigated some losses during such periods by shifting to CASH or bonds.
We’ve implemented this improved version of this strategy and we are running it in real time. Follow our X account for updates on the verified track record and performance.
We hope the community can benefit from this PSR & Relative Strength strategy inspired by What Works on Wall Street. Feel free to test it, tweak it, and share your improvements as we work toward a best-in-class approach to value-momentum investing.
Mia Alissi
To resolve the issues in your code, you should ensure that all necessary namespaces are included. Here are the appropriate namespaces based on the missing types and functions in your algorithms:
For
PSRMomentumStrategy.cs
:using QuantConnect.Indicators;
. This will provide access to theRateOfChange
class.using System.Collections.Generic;
for the use of theDictionary
type.using QuantConnect.Securities;
for handling security-related updates and changes.For
PSRUniverseSelectionModel.cs
:using System.Collections.Generic;
is present for collections likeIEnumerable
.using QuantConnect.Data.UniverseSelection;
to access universe selection functionalities.Adding these using directives at the beginning of each file should resolve the compilation errors related to missing references.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Jared Broad
Hey Dave, we have finished the code changes required to maintain backward compatibility but didn't want to deploy it on the weekend. We've now got the data, code, and new tests in place and will re-deploy Monday-AM.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Dave Mueller
Awesome! I'm going to check it out tonight =)
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Jared Broad
Sorry Dave still delayed; please subscribe to notifications and I'll update this thread as soon as its pushed. We found differences in the ticker symbology and are mapping the tickers back to the current QC format so the data should be nearly identical and not require changes to your code.
It'll likely be 1 day of engineering, 2 days of data processing and then 1 day of retesting. ETA Thursday-Friday.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Arthur Asenheimer INVESTOR
Take all the time you need. Stability and reliability is more important than a quick implementation.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Grigori Gustin
Hi Jared/QC team,
I have noticed that there is access to ask/bid prices in research notebooks for second resolution.
However, I could not access to tick data - is there any work still in progress or the problem is in my code?
Also, is ask/bid data is already available during backtesting?
Thanks, Grigori.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Jared Broad
Hey Grigori! Yes, it was deployed quietly yesterday.
Tick data is also available but it is not the same format as QuoteBars, each Tick has a TickType attached to it. The value of TickType.Quote marks ticks which are bids/asks. These are presented as a list for a specific moment of time.
Our tick data for Equities is now also timestamped to the millisecond! Previously it was rounded down to the previous second
--.
Live Trading does not have the new quote feed yet -- we're working on that and it'll be installed in the next week or two. We're literally waiting on physical delivery of some 10GB fiber modules and with the virus, everything is moving slowly.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Grigori Gustin
> Tick data is also available but it is not the same format as QuoteBars, each Tick has a TickType attached to it.
Trying to access Resolution.Tick through qb.History() call gives me the following exception:
"Exception : cannot handle a non-unique multi-index!"
Still did not figure out the root cause, the date range seems valid (couple of hours) and it worked before.
Could you please help me on this?
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Jared Broad
No problem Grigori but please create a new thread with a sample attached of what you're trying to do or send in a ticket for private support.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Hugh Todd
I've been testing the quoteBars in slice with some low volume ETFs I follow and the availability of bid/ask improves the information content gathered from these price series. Thanks for the continuing improvements to the site. When do you see this data being available for live trading? Thanks, Hugh
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Jared Broad
Thanks Hugh;
All going well - we'll do the installation of the new live feed this weekend. We've wired up a brand new rack and are just waiting on a cross-connect cable install for the new data feed. Old live algorithms will need to be stopped and redeployed to move to the new infrastructure.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Laurent Crouzet
Jared Broad I really think it will be an important and a very useful development for QC and the QC's community that all algorithms (those that are working and the new ones) use the new bid/ask structure!
If I understand well, that would also imply that all currently validated Alphas (those on the marketplace) will be stopped and redeployed, right?
Does it also mean that it would deplete the portfolio (cancellation of all insights) of these Alphas? Or as long as everything goes smoothly during the week-end (as no market is open), the Alphas will still keep their current investments?
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Hugh Todd
Thanks Jared. We appreciate the efforts you all are putting into this.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Jared Broad
Pleasure Hugh!
Laurent: All QuantConnect backtest algorithms currently use spread, and soon live trading will as well. Once the new live feed is installed Alphas will need to be stopped and redeployed. An Alpha should reinitialize its state in the event of a shutdown, so it should resume their previous positions. When we eventually restart them we'll do it after market close; before universe selection; on Friday. This should minimize the impact of most of the alphas. We'll mark on the charts when the alpha was redeployed with the spread data.
A nice side effect as well -- our new live history server should be 10x faster =) Not quite sure how much faster yet as it's a new approach which should make things close to backtesting speeds.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Laurent Crouzet
Ok, thank you Jared. Hopefully, everything will be as smooth as possible!
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Davide Carbone
Hi Jared,
do you have an estimated release date for the L1 Equity Quote in live mode?
Thanks
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Cary Cocke
Words cannot express my thanx and praises enough!
OUTSTANDING WORK......this is why I love QC
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Arthur Asenheimer INVESTOR
Now that L1 Equity Quotes are available for backtesting, the next step would be a good market impact model (slippage model).
For example, when a Buy Market Order is submitted, I have to take into account not only the spread, but also the available volume at the next best bid price offer.
So if you want to buy 1,000 shares of XYZ and the current bid price is $ 100.00, but only 100 shares are offered at that price, the order will not be executed in full at $ 100.00, but will reach the next level in the order book and execute the next orders at $ 100.01 and so on.
As a result, the average execution price wil be higher than current backtesting suggests.
If you want to display it 100% realistically, you would need the complete history with the highest granularity (Tick) of the entire order book (Full DOM = Full Depth of Market, i.e. Level 2 Data). You can imagine that this would pose completely new challenges to the hardware performance as the data volumes would be enormous. Therefore it makes sense to work with models that are very close to reality.
Quantopian offers various slippage models for this. I personally prefer to talk about market impact models as this is also common practice in the scientific literature.
As you can see in the documentation here, the Alpha Streams Brokerage Model uses a constant Slippage model.
So my question is: Since we now have L1 Equity Quote Data, I wonder if it wouldn't be possible to create better/more realistic Slippage Models based on that data?
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Arthur Asenheimer INVESTOR
Edit: Edit: A good approach would be the square-root formula for market impact, which we can use now where L1 Quote Data and thus the Spreads are available.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Derek Melchin
Hi Arthur,
Interesting suggestion. Users will find our documentation on creating custom slippage models useful when implementing this.
To go forward with this, I recommend starting a new forum thread where alternative slippage models can be discussed. Such a discussion is out of the scope of this thread.
Best,
Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Hugh Todd
Is this available for live trading yet? I'm seeing errors when I try to reference quote bars during live trading with QC data and don't know if it is my model or the state of development.
Thanks, Hugh
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!