I was recently wondering if I could capture some of the end-of-day moves that can happen in stock index markets. These are the strong moves that might occur during the last hour or so of the regular session. See the image below.
So the basic idea would be to open a trade 1-2 hours before the close and exit the trade just before the market closes.
When would I open a new trade? Well, there are many ideas. You could open a trade if the current price is above/below today's open. Or you could open a trade if the current price is above/below yesterday's high.
I recently ran across TradeStation's midpoint function, which got me wondering if that would work as a decent starting point for this afternoon trading idea.
The midpoint function is the middle between today's highest high and lowest low. Put another way; it's the middle of today's range.
Below is an image of the midpoint indicator (white line) applied to a 5-minute chart of the @ES.D.
At 1300 Central, we decide to enter a trade or not. We go long/short if the current price was above/below the midpoint value. Then, close the trade at the end of the day.
In EasyLanguage, the code would look something like this:
if (Close < Threshold) and (Time >= 1300) and (Time <= 1445) then
Sellshort ( "Trend SE" ) next bar at market;
- Starting account size of $25,000
- Dates tested are from 2007 through November 30, 2020
- Trading 1 contract
- Max two trades per day
- $30 deducted for slippage and commissions per trade
- No stops
If we take long trades when above the midpoint and take trades below the midpoint, we get an ugly picture.
Are we finished?
Bull/Bear Regime Filter
Once again, I will apply a 200-day simple moving average to my strategy and test the following ideas.
- Go long only during a bull market
- Go long only during a bear market
- Go short only during a bull market
- Go short only during a bear market
Which one of these test came out the winner?
No too surprisingly the results above are from taking long trades in a bear market. I say not too surprisingly because the E-mini S&P tends to have strong mean reverting characteristics and during a bear market, strong rallies into the close do happen.
Long Trades Only In Bear Market
It's clear that the short side is not productive. Let's look at only taking long trades.
The strategy in this article is far from a complete system. We can see the average net profit is about $58, which is too low in my opinion. Looking at the equity curve, we can see it's far from ideal as it has some significant drawdowns and stagnate regions. But we're moving in the right direction. Other filters may help reduce unproductive trades and boost our performance.
What else could we test? Well, what about selling short if the price is above the midpoint? Or, going long if the price is below the midpoint? How about testing the impact of volatility on the performance? Do other breadth indicators have a positive impact? How does is it perform on other markets?
It's these types of ideas that can lead to profitable trading systems so, get busy!
If you want to learn how to test ideas like this using EasyLanguage, look at my Builder Edition of System Development Master Class. It's all about learning EasyLanguage so you can turn your ideas into EasyLanguage and discover trading edges.