Have you ever wondered if the seemingly random gaps that occur when the market opens could be the key to a powerful trading strategy? Imagine turning these unpredictable moments into a reliable edge in your futures trading. Today, we're diving deep into the gap momentum strategy to uncover its true potential and see if it can revolutionize your trading game.
Gap momentum trading is a fascinating strategy that taps into the often-overlooked phenomenon of market gaps. This technique draws its inspiration from the pioneering work of J. Welles Wilder and Joseph Granville's innovative On-Balance-Volume (OBV) method. Wilder, known for developing several technical analysis tools, was keenly interested in market gaps and their implications. Granville's OBV method, which accumulates volume based on price movements, laid the groundwork for analyzing momentum in a novel way.
By examining the difference between today's open and yesterday's close, traders can accumulate a series of positive and negative gaps to derive a gap ratio. When smoothed with a moving average, this ratio becomes a powerful indicator of market momentum.
In this article, inspired by Perry J. Kaufman's work in "Gap Momentum," published in Technical Analysis of Stocks & Commodities, we will delve into the mechanics of the gap momentum strategy, explore its application in futures markets, and present our findings from extensive testing.
I aim to determine whether this technique can offer a reliable edge in futures trading and provide actionable insights for algorithmic traders looking to enhance their strategies.
Understanding Gap Momentum
Historical Context
To fully appreciate the gap momentum strategy, it's essential to understand its roots. This approach draws heavily from the work of two notable figures in technical analysis: J. Welles Wilder and Joseph Granville. Wilder, a renowned technical analyst, developed several widely used indicators, including the Relative Strength Index (RSI) and the Average True Range (ATR). His fascination with market gaps—those sudden jumps in price that occur when the market opens—led to insights about their potential impact on future price movements.
Joseph Granville, another pioneer in technical analysis, introduced the On-Balance Volume (OBV) method. OBV accumulates volume based on whether prices close higher or lower than the previous day. This cumulative volume can reveal trends only after a period of time from price data alone. Granville's work showed that volume precedes price, meaning significant volume changes often lead to price movements.
Concept Explanation
Building on these foundations, the gap momentum strategy uses opening gaps to gauge market momentum. Here's a step-by-step breakdown of how this works:
- Identify the Gap: The gap is simply the difference between today's opening price and yesterday's closing price. If today's open is higher than yesterday's close, it's a positive gap. If it's lower, it's a negative gap.
- Calculate the Gap Ratio:
- Positive Gaps: Sum all positive gaps over a set period (e.g., 20 days).
- Negative Gaps: Sum all negative gaps (as positive numbers) over the same period.
- Gap Ratio: Divide the sum of positive gaps by the sum of negative gaps. This ratio reflects the balance of upward versus downward momentum.
- Create a Cumulative Series: Starting with zero, add the gap ratio to a cumulative total each day. This running total is the gap momentum indicator.
- Smooth the Indicator: Apply a moving average to the gap momentum indicator to smooth out the noise and provide a clearer signal. The length of this moving average can vary, but a common choice is 20 days.
Example Calculation:
Let's walk through a simple example with a 5-day period:
- Day 1: Open = 102, Close = 100, Gap = 2 (positive)
- Day 2: Open = 101, Close = 103, Gap = -2 (negative)
- Day 3: Open = 104, Close = 101, Gap = 3 (positive)
- Day 4: Open = 102, Close = 104, Gap = -2 (negative)
- Day 5: Open = 105, Close = 103, Gap = 2 (positive)
Summing the gaps over 5 days:
- Positive Gaps: 2 + 3 + 2 = 7
- Negative Gaps: 2 + 2 = 4
- Gap Ratio: 7 / 4 = 1.75
Each day, we add this ratio to the cumulative series. If we start with zero, the cumulative series over five days will be:
- Day 1: 0 + 1.75 = 1.75
- Day 2: 1.75 + 1.75 = 3.5
- Day 3: 3.5 + 1.75 = 5.25
- Day 4: 5.25 + 1.75 = 7
- Day 5: 7 + 1.75 = 8.75
Trading Signals
Once we have our smoothed gap momentum indicator, we can use it to generate trading signals:
- Buy Signal: When the smoothed gap momentum indicator turns upward, indicating increasing positive gaps.
- Sell Signal: When the smoothed gap momentum indicator turns downward, indicating increasing negative gaps or decreasing positive gaps.
By following these signals, traders can capture the momentum market gaps indicate.
Understanding the theory and calculation behind the gap momentum indicator is crucial. In the next section, we'll dive into how to implement this strategy in EasyLanguage and test it on various futures markets to see how it performs.
Implementing the Gap Momentum Strategy
Implementing the gap momentum strategy in EasyLanguage involves several steps, from setting up the inputs and variables to calculating the gap momentum indicator and generating trading signals. Here’s a detailed guide to help you understand and implement this strategy.
Step 1: Defining Inputs and Variables
First, we must define the inputs and variables used in our EasyLanguage script. These include the number of periods to evaluate gaps, the period for calculating the signal average, and the trading bias (long, short, or both).
Step 2: Calculating Gap Momentum
We then calculate the gap momentum using a custom function. This function evaluates the gaps over the specified period and computes the gap ratio.
Step 3: Implementing Trading Logic
After calculating the gap momentum, we implement the trading logic based on the signal generated. This involves buying or selling based on the direction of the gap momentum indicator.
Notice this is a stop-and-reverse strategy. Put another way, it's constantly switching between long and short.
Step 4: Testing and Optimization
Finally, we test the strategy in various future markets to evaluate its performance. This involves running the script on historical data, which we'll do in the next section.
Testing the Strategy on Futures Markets
I will test this concept on the @ES, @GC, and @CL markets. I like to trade these markets and should provide a decent representation of the Gap Momentum concept.
I'm going to create three charts for each of our three markets to test with the following settings:
- In-Sample History: 2006-2021
- Out-of-Sample History: 2022-June 25, 2024
- Timeframe: Daily Bars
- Slippage and Commissions: $0
- Maximum Bars: 200
I will then optimize the following Gap Momentum strategies across the following input ranges:
- iPeriod: 5 to 60 in steps of 5
- iSignalPeriod: 5 to 100 in steps of 5
- iSignalTrigger: 1 to 10 in steps of 1
- iLSB: -1 to 1 in steps of 1
After I optimize the in-sample historical data, I will apply the best settings to the out-of-sample data. This will give us a more realistic look at the performance.
Results of the Gap Momentum
@ES Market Results
It is not too surprising that the optimizer picked the long side as the best-performing. We see this constantly as the stock index markets have a historical long-side bias. Below are the optimized results applied to the out-of-sample data segment.
@GC Market Results
For the gold market, we're taking both long a short trades. However, the long side does appear stronger. This market appears to be the best performing with the Gap Momentum indicator.
@CL Market Results
The crude oil market is also taking both long and short trades. The first thing I noticed was moving to the out-of-sample did very poorly. Virtually no net profit and huge drawdown.
@ES (Long) | @GC (Long/Short) | @CL (Long/Short) | |
---|---|---|---|
Net Profit | $29,075 | $53,620 | $5,060 |
Profit Factor | 1.25 | 1.56 | 1.02 |
Total Trades | 87 | 60 | 173 |
Avg.Trade Net Profit | $234 | $893 | $29 |
Max Drawdown | $41,637 | $25,530 | $79,930 |
NP vs. DD | 0.7 | 2.1 | 0.1 |
Summary Results of the Gap Momentum
Keep in mind these are not trading systems! This is a market study to test the potential value of using a Gap Momentum indicator in my trading.
Overall, I'm not overly impressed with the results, but I will add it to my toolbox as it shows some promise.
Practical Application for Traders
How might you use Gap Momentum?
Understanding the theoretical foundation and implementation of the Gap Momentum strategy is just the beginning. To truly harness its potential, it is crucial to explore practical applications that can be seamlessly integrated into your trading routine.
The Gap Momentum could be used as a filter for existing strategies. For example, when the gap ratio is climbing, this would be seen as a time to take long trades. If it's falling, this is a time to go short to halt trading. Below are more detailed examples.
Intraday Trading: You could use the Gap Momentum strategy to identify a bias in the market and focus on intraday price movements. If the Gap Momentum is rising, you look for intraday-long opportunities.
Swing Trading: For those who prefer holding positions for several days, the Gap Momentum strategy might help identify short-term trends and potential reversals, providing entry and exit signals based on accumulated gap data.
Risk Management: The strategy can be integrated into a broader framework. With gap momentum signals, traders can set more informed stop-loss levels and manage position sizes to reduce exposure during volatile market conditions.
Supplementing Technical Analysis: Gap Momentum can be used alongside other technical indicators to confirm signals. For example, traders might use it to validate signals from moving averages, RSI, or MACD, enhancing overall decision-making.
Volatility Trading: Traders can use the strategy to take advantage of periods of high volatility, where gaps are more prevalent. By focusing on markets and times when gaps are common, they can exploit these opportunities for potential profits.
Key Takeaways
In this article, we delved into the gap momentum trading. Here are the key takeaways:
- Understanding Gap Momentum:
- Gap momentum trading leverages the differences between today's opening price and yesterday's closing price to gauge market momentum.
- The strategy draws inspiration from J. Welles Wilder and Joseph Granville’s On-Balance Volume (OBV) method, incorporating their insights into a modern trading approach.
- Calculating Gap Momentum:
- Positive and negative gaps are accumulated over a specified period to calculate a gap ratio.
- This gap ratio, when smoothed with a moving average, forms the gap momentum indicator used for generating trading signals.
- Implementing the Strategy:
- We provided a detailed EasyLanguage script to calculate the gap momentum indicator and generate buy/sell signals.
- The strategy involves defining inputs and variables, calculating gaps, computing the gap ratio, smoothing the indicator, and implementing trading logic based on the signal.
- Testing and Results:
- The strategy was tested on various futures markets, including the E-mini S&P 500 (@ES), Gold (@GC), and Crude Oil (@CL).
- Optimization of input parameters was conducted to evaluate performance, and results were analyzed for both in-sample and out-of-sample data.
- Practical Applications:
- The Gap Momentum strategy might act as a primary single for a trading system. Other stops, target and exits will need to be explored.
- The Gap Momentum indicator may act as a filter for strategies locating potential bias (long/short) in a given market. This how I plan on using the Gap Momentum indicator in my own trading.
By integrating the Gap Momentum strategy into your trading routine, you can potentially enhance your ability to filter the over all market bias (long/short) allowing you to generate better trading signals.
I plan on adding Gap Momentum as part of my testing process. In particular I'm looking at using it as a Regime Filter.
As always, continuous testing is required.