In this article, I will see if applying Gap Zones to the Overnight Edge will improve performance. Gap Zones are a quick filter you can use for your strategies as well. The code used in this article is available for you to use!
This article is a continuation of a previous article, The Overnight Edge. As a quick recap of the previous article, many day traders discuss the advantages of closing out their positions at the end of the day. I created a simple market study that highlights a long edge in exploiting by holding through the overnight session. You can read about it here.
In the following study, we're only taking trades on the long side. Dates tested are from January 1, 2007 through January 11, 2023. Slippage and commissions are not deducted. We're trading the symbol @ES.D.
Let's get testing.
My introduction to Gap Zones was many years ago when I got my hands on Scott Andrews's book, "Understanding Gaps." Scott is also known as "the Gap Guy," and as you can imagine, his book is all about gap trading.
What I want to focus on in this article is Scott's idea of Gap Zones. Gap Zones are a way to classify today's price action based upon what happened yesterday.
Below is a graphic taken from Scott's book where you can see there are ten different zones based upon yesterday's price action
Gap Zones as defined by Scott Andrews:
If the previous day was a down day:
- Zone 1 - Today's Price is above yesterdays high
- Zone 2 - Today's Price is between yesterdays open and high
- Zone 3 - Today's Price is between yesterdays open and close
- Zone 4 - Today's Price is between yesterdays close and low
- Zone 5- Today's Price is below yesterdays low
If the previous day was an up day:
- Zone 6 - Today's Price is above yesterdays high
- Zone 7 - Today's Price is between yesterdays high and open
- Zone 8 - Today's Price is between yesterdays open and close
- Zone 9 - Today's Price is between yesterdays open and low
- Zone 10 - Today's Price is below yesterdays low
Scott used this information to help filter gap trades for the current day. Depending upon today's Gap Zone, a given trade may tend to work out well or not. In some cases applying the Gap Zone as a filter dramatically proved trading performance.
The question is, will it help us in the overnight session?
Added The Gap Zone Code
First I'm going to create an input called GapZone which will be used to test each of the possible Gap Zones.
If we set GapZone to zero, that will tell the strategy to ignore the Gap Zone filter. Otherwise, GapZone can hold the values 1-10 representing our ten Gap Zones.
Then, I'm going to create some variables to hold important price information.
PrevClosed = close;
PrevOpen = open;
PrevHigh = high;
PrevLow = low;
I'm then going to use these variables to simply see what Gap Zone we're in based upon today's opening price.
I'll also create a variable called TradeGapZone that will tell our strategy if today is a valid Gap Zone. For example, if we're testing Gap Zone 7 and today's price is Gap Zone 7 then TradeGapZone is set to true and trade is opened.
If ( TodaysOpen > PrevHigh ) and ( GapZone = 1 ) then
TradeGapZone = true // Zone 1
Else If ( TodaysOpen < PrevOpen ) and ( TodaysOpen >= PrevClosed ) and ( GapZone = 3 )
then TradeGapZone = true// Zone 3
Else If ( TodaysOpen < PrevClosed ) and ( TodaysOpen >= PrevLow ) and ( GapZone = 4 )
then TradeGapZone = true // Zone 4
Else If ( TodaysOpen < PrevLow ) and ( GapZone = 5 ) then
TradeGapZone = true; // Zone 5
Else Begin // Yesterday Up Day
If ( TodaysOpen > PrevHigh ) and ( GapZone = 6 ) Then
TradeGapZone = true // Zone 6
Else If ( TodaysOpen >= PrevClosed ) and ( TodaysOpen <= PrevHigh ) and ( GapZone = 7 ) Then
TradeGapZone = true // Zone 7
Else If ( TodaysOpen >= PrevOpen ) and ( TodaysOpen < PrevClosed ) and ( GapZone = 8 ) Then
TradeGapZone = true // Zone 8
Else If ( TodaysOpen >= PrevLow ) and ( TodaysOpen < PrevOpen ) and ( GapZone = 9 ) Then
TradeGapZone = true // Zone 9
Else If ( TodaysOpen < PrevLow ) and ( GapZone = 10 ) Then
TradeGapZone = true; // Zone 10
That's basically it.
The Over Night Edge on S&P Futures
Let's take a look at trading the overnight session on the @ES.D symbol. This test does not take into account slippage or commissions. There are no filters. We open a trade every night (15:15 PM Central) and close the market open (8:30 AM Central) the next day. Below is the equity curve.
You can see the equity curve rises nicely. But you can't trade this as the average profit per trade is about $21. Below are some important performance metrics.
We can now apply our Gap Zones filter. I will optimize the input parameter GapZone with the values 0-10 to test which Gap Zone(s) may produce the best results. Why start at zero? Remember, if we set GapZone to zero, that disables the Gap Zone filter. I do this so I can see the results without the filter alongside my other results.
Here is the optimization report organized in descending order based upon average profit per trade. Click the image for a larger view.
You can see that Gap Zone 5 is the best option. Only take trading with Gap Zone 5 produces an average profit of $155 per trade and the following equity curve.
A huge improvement!
What is Gap Zone 5? Looking at the Gap Zone chart above, Gap Zone 5 is when 1) The previous day was a down day and 2) Today's open was below yesterday's low.
That's an ugly trade, right? We have a down day yesterday and today's open is below yesterday's low. Yet, when you buy at the close and exit your position, you get the following results..
With Gap Zone 5
Adding A Trend Filter
As we enter the bear market of 2022, the overnight edge does not hold up either. Bull markets are where this edge is the strongest. How can we avoid unproductive bear markets? Adding our standard 200-day simple moving average as a regime filter is a filter known to work well. Let's add that.
This means we'll only take trades when the price is above a 200-period simple moving average. When the price is above the 200-period simple moving average, we are in a bull market and free to trade. When the price is below the 200-period simple moving average, we are in a bear market and don't trade. The equity curve and results are below.
We can see a considerable drawdown reduction and a solid increase in NP/DD, Profit Factor, and average profit per trade. Sure, we're making less money as we are trading less often. But overall, the improvements look good.
What Else Can We Do?
What other filters could we test?
Seasonality: You could create a simple filter that only takes trades during specific months. Thus, measuring the impact of different seasons on the overnight edge. Thinking along these lines, you could also test a day-of-the-week filter. Does Friday perform better than Thursday? Is Wednesday a day to avoid opening new trades?
Combine Zones: Looking at the optimization report once again, we can see the second choice is Zone 8. This zone happened when the previous day was an up-day, and today's price is between yesterday's open and close. You could combine Zone 8 and Zone 5. Thus, taking trades in either of these zones. This will add more trades and more profit.
Can We Turn This Into A Real Trading System?
Using Gap Zones can provide significant benefits to taking advantage of the overnight trades. Could this be turned into a real trading system? I think so!
I would move to a smaller timeframe, such as a 5, 10, or 15-minute chart. Moving to these smaller timeframes would allow me to enter trades after the close and better monitor the trades overnight. I would also explore what my stop would be. Another idea to test would be holding the trade until the next day's close vs. closing it at the open.
This should provide you with some great ideas to test on your own.
Best of luck!
great idea mr Jeff…
Thanks, Roberto. Glad you liked it.
I can’t find the code, can I have the link? thank you
Did you log into the members area. Your email is your username.
As usual, always interesting. However, in all three examples, it appears that in the last third of the trades the equity curve indicates a change in market characteristics? Also, I always like to compare to buy&hold as an acid test. Your thoughts?
The current market is bearish, so that’s probably what you’re seeing. Just before the bear, the market characteristics do change. This is not to say, this idea is not valid. Comparing to a buy and hold would be a good idea. Buy and hold often has huge drawdowns. If you run the Buy and Hold test let me know what you find.