SPY Broke Out of a Narrow Trading Range on 5/17/2023, but Our Backtest Suggests it’s Not Bullish for the Open. [Article] (Point-and-Click TradeStation® Strategy)
Original Trading Strategy
Peer Reviews, Modifications & Responses
Thanks for Sharing!
Trading Strategy Article
Summary: SPY’s daily bar on 5/17/2023 clearly broke out of the narrow trading range of its last several bars with multiple factors that make the breakout stand out visually on a chart but beware of buying SPY at the open with the expectation of riding SPY up for the next several bars.
SPY’s breakout on 5/17/2023 had the following characteristics:
- The previous seven bars traded in a narrow range. The highest open or close was only 0.88% higher than the lowest open or close.
- The 5/17/2023 bar opened above the close and the open of the previous bar.
- The 5/17/2023 bar was a clear breakout bar. It closed 1.21% above its previous close and was up 0.70% from its open.
Are the above factors bullish, bearish, or non-predictive? Many technicians would say bullish, but we found that they were actually non-predictive over the last almost 30 years of market data. We created a Quagensia T Edition strategy, generated its TradeStation® EasyLanguage® code, and backtested the TradeStation® EasyLanguage® strategy to test a trading idea that enters a long trade on the open of the daily bar that occurs after market action whose characteristics were very similar to those mentioned above and holds the long trade for the same number of bars as the number of bars in the narrow market range.
Our specific entry criteria were to enter on the open of the daily bar that occurs directly after the daily bar with the following characteristics:
- Since the seven bars prior to the 5/17/2023 daily bar traded in a narrow range such that the highest open or close was only 0.88% higher than the lowest open or close, we allowed a minimum of 0.48% and a maximum of 1.28% for this metric for the seven bars prior to the daily bar that was the breakout bar.
- The daily bar that was the breakout bar must open above the close and the open of the previous daily bar to match this characteristic of the 5/17/2023 bar.
- The daily bar that was the breakout bar must close between 0.81% and 1.61% above the close of the previous bar since the 5/17/2023 bar’s value for this metric was 1.21%.
- The daily bar that was the breakout bar must close between 0.30% and 1.10% higher than its open since the 5/17/2023 bar’s value for this metric was 0.70%.
- A position is not entered if the strategy is already long.
The strategy closes the long position after seven bars, which was the same number of bars that traded in a narrow range prior to the 5/17/2023 bar.
A backtest of this TradeStation® EasyLanguage® strategy was done over the entire history of daily bars of SPY in TradeStation® 10, which goes back almost 30 years, using a commission of $4.95 per trade and a slippage of $0.02 per share. The entry criteria listed above occurred 32 times, with the first trade in the backtest being entered on 10/15/1993 and the last trade being exited on 6/16/2021.
According to this TradeStation® EasyLanguage® strategy’s TradeStation Strategy Performance Report, this strategy’s backtest indicates that trading these 32 daily breakouts in the past, using the entry rules and exit rule as described, would have actually led to a small loss. By running a backtest, we were able to determine that the breakout of the 5/17/2023 SPY daily bar should not be considered particularly bullish and should not be the main reason why a trader enters a long trade when the market opens on Thursday, 5/18/2023 and exits seven bars later. You may have other valid reasons why you should buy SPY on the open, but the breakout that was tested with the assumptions and thresholds described in this article should not be one of them.
We invite you to download the Quagensia T Edition strategy on this page, open it in Quagensia T Edition, generate its TradeStation® EasyLanguage® strategy code and test it in TradeStation® 10 where you should be able to verify our results. You can explore the effect of tightening or loosening the thresholds for the entry criteria by changing the values of the strategy’s input parameters in TradeStation®. Finally, if you have a valid paid license for Quagensia T Edition you can change the Quagensia T Edition strategy’s logic without code to more closely match how you see the market action of the 5/17/2023 SPY breakout.
This article is an example of algorithmic journalism. We invite content creators to use a Quagensia Desktop Application to create their own articles based on tested trading ideas. And we invite traders to use a Quagensia Desktop Application to test their ideas before they trade them.
This trading idea is subject to the disclaimers in our Terms of Service.
How to Get the Quagensia Strategies
The downloadable zip file linked to below contains Quagensia T Edition (for TradeStation®) files and/or auxiliary files that were created by us at Quagensia, Inc.:
Click the link above to download the zip file and unzip it. If this zip file contains point-and-click Quagensia Trading Strategy files for your edition of the Quagensia Desktop Application, put the point-and-click Quagensia Trading Strategy files into your “My Algos” folder as described in the video Downloading & Importing Third-Party Strategies into Quagensia N Edition (for NinjaTrader®) or Downloading & Importing Third-Party Strategies into Quagensia T Edition (for TradeStation®).
Customize Quagensia Strategies with Your Own Ideas
Tweaking Quagensia Trading Strategies using point-and-click with the Quagensia Desktop Application is easy for non-programmers. If you get stuck you can usually find the answer you need in our online help documentation or you can ask a question in our friendly Discord community.
If you don’t want to tweak a Quagensia Trading Strategy with point-and-click to add your own proprietary trading logic, you can still download a Quagensia Trading Strategy file, open it up in the Quagensia Desktop Application, and generate its code, then backtest and optimize the trading strategy on different instruments, different bar periods (weekly bars, daily bars, hourly bars, 15-minute bars, etc.), or different bar types (time-based bars, volume-based bars, tick-based bars, etc.), and use different start and end dates.
Some tweaks you can make to the Quagensia Trading Strategies you download include:
Modify the entry & exit logic.
- Add more conditions, remove conditions, or change them by choosing from among a very large number of components, including many exotic indicators.
- Add or modify stop losses, trailing stops, and profit targets. Make them tighter, less tight, or based on an entirely different calculation.
- Add or modify time stops. For example, exit after a certain number of bars either unconditionally or only if the post-entry price action did or did not exhibit certain characteristics.
Enhance the output of the strategy to go beyond simply placing orders.
- Draw lines, shapes, and text on the chart. For instance, you can mark times or prices where each entry or exit condition of a multi-condition entry or exit was true, even if all the necessary entry or exit conditions were not true at the same time so an entry or exit did not occur.
- Write information to NinjaTrader®’s NinjaScript® Output window or TradeStation®’s EasyLanguage® Print Log window.
- Write information to a file. You can even output a report that can be opened in Microsoft Excel or consumed by another application that reads comma-delimited, semicolon-delimited, or otherwise character-delimited tabular data files.
![SPY Broke Out of a Narrow Trading Range on 5/17/2023, but Our Backtest Suggests it’s Not Bullish for the Open. [Article] (Point-and-Click TradeStation® Strategy) SPY Broke Out of a Narrow Trading Range on 5/17/2023, but Our Backtest Suggests it’s Not Bullish for the Open. [Article] (Point-and-Click TradeStation® Strategy)](https://eadn-wc02-5937971.nxedge.io/images/trading-idea-images/2023/05/17/quagensia/spy-broke-out-2023-05-17-but-our-backtest-suggests-its-not-bullish-t.png)
