DAX Trading: Exploring an Opening Range Breakout Strategy – Code and Optimizations

In this article, we'll delve into one of the most renowned and popular entry setups in trading: the Opening Range Breakout (ORB). This strategy was introduced in the 1990s by American trader Toby Crabel, and today, we’ll see how it applies to Europe’s leading stock index future, the DAX.

So, what exactly is the ORB? Crabel's concept is rooted in the belief that the initial phase of trading often provides the most critical insights into the market's direction for the rest of the day. Specifically, breaking above or below key price levels, like the high or low of the first hour, frequently signals a continuation of that trend until the market closes.

Let's break down the strategy: Our test will focus on the “classic” DAX session from 8:00 to 22:00 (exchange time). While the market session has expanded in recent years, this historical session still offers the most accurate backtesting conditions. Additionally, it's the most liquid session, making it ideal for a breakout strategy like the ORB, which targets significant price level breakouts. For optimal entry level precision, we'll use 15-minute bars.

ORB Trading Rules and System Code for the DAX

After the first hour of trading, which defines our Opening Range, the session’s highs, lows, and entry points are calculated on the first available bar. This point, referred to as “checktime,” is set at 9:15 (since the first hour ends at 9:00, and with 15-minute bars, the first subsequent bar is timestamped 9:15).

Once the entry levels are calculated, the system is free to operate throughout the day until 15 minutes before the session ends (21:45). We’ve established a broad trading window (9:15-21:45) to initiate trades, which is fine-tuned using the inputs “MyStartTrade” and “MyEndTrade.”

For more details: The LONG entry level is calculated by adding the session range (high – low) to the opening of the 9:15 bar, multiplied by a factor initially set to 1 (MyMultL). Thus, a position is initiated when the price breaks above this level, known as MYLELevel:

MYLELevel= open + range * MyMultL

Conversely, the SHORT entry level is determined by subtracting the session range (high – low) from the opening price, also multiplied by a factor initially set to 1 (MYMultS). A position is initiated when the price breaks below this level, known as MYSELevel:

MYSELevel=open – range * MyMultS

The MultiCharts PowerLanguage code is as follows:

var: IsStartOfSession(true); 

var: MyLELevel(0), MySELevel(0);

input: checktime(915);

Input: MyStartTrade(0915),MyEndTrade(2145);

Input: MyMultL(1), MyMultS(1);

Input: MyStop(5000);

if IsStartOfSession then begin

MyLELevel=0;

MySELevel=0;

end;

if time=checktime then begin

MyLELevel = open+(highd(0)-lowd(0))*MyMultL;  

MySELevel= open-(highd(0)-lowd(0))*MyMultS;

end;

if time>MyStartTrade and time<MyEndTrade then begin

buy next bar at MyLELevel stop;

sellshort next bar at MySELevel stop;

end; 

If MyStop > 0 then setstoploss(MyStop);

setstopcontract;

setexitonclose;

Trades initiated are closed at the end of the day (22:00), unless the stop loss is triggered.

This image has an empty alt attribute; its file name is fig-1-2-1-1024x631.png

Figure 1 – Example of calculating MYLELevel and MYSELevel

Performance Report of the ORB Trading System on the DAX

Figures 2 and 3 display the trading system’s results without applying additional filters, covering the period from January 1, 2010, to October 31, 2023.

This image has an empty alt attribute; its file name is fig-2-1-1024x690.png

Figure 2 – Detailed Equity Curve of the ORB Trading System on the DAX

Figure 3 – Strategy Performance Report of the ORB Trading System on the DAX

It’s evident that the strategy, as currently applied, isn’t very effective, particularly on the short side, while the long side shows some potential for profitability. Remember, we applied this setup in a very rudimentary fashion, without any additional filters to refine trade selection.

Optimizing the ORB Trading System on the DAX

Let's advance our study: Initially, we allowed the trading system to place orders across a broad timeframe (9:15-21:45), covering most of the session.

Now, let’s explore whether restricting it to specific hours of the day might enhance profitability.

We will optimize our “MyStartTrade” and “MyEndTrade” inputs.

This image has an empty alt attribute; its file name is image-11-1024x603.png

Figure 4 – Optimization of MyStartTrade and MyEndTrade

The results suggest that entering positions after 10:00 AM but before the afternoon significantly improves key metrics. Given the net profit and average trade results, the 10:00-16:00 window is optimal as it yields better drawdown outcomes.

Figures 5 and 6 present the Equity Curve and the Strategy Performance Report with a net profit exceeding 218,000 euros, yet two key areas remain for improvement: the drawdown is still too high, and the average trade (66.89 euros) isn’t sufficient for live trading due to real-time trading costs (slippage and commissions).

This image has an empty alt attribute; its file name is image-12.png

Figure 5 – Detailed Equity Curve of the ORB Trading System on the DAX after time window optimization

Figure 6 – Strategy Performance Report of the ORB Trading System on the DAX after time window optimization

What other directions can we consider at this stage? How can we boost the average trade to make it acceptable? One option might be to adjust the multipliers (MyMultL and MyMultS) initially set to 1. Let’s run an optimization, setting a range from 0.3 to 2 with 0.1 increments for these inputs, and analyze the results.

This image has an empty alt attribute; its file name is image-2-10.png

Figure 7 – Optimization of MyMultL for the ORB Trading System on the DAX

This image has an empty alt attribute; its file name is image-2-11.png

Figure 8 – Optimization of MyMultS for the ORB Trading System on the DAX

For MyMultL (Figure 7), we select the parameter 0.4 as it notably improves net profit (from 218,000 to approximately 360,000 euros) and average trade (from 66.89 to 85 euros). Additionally, it’s within a stable range between values 0.3 and 0.5, which are also comparable in results.

For MyMultS (Figure 8), we choose the parameter 0.9 as it slightly enhances net profit and is similarly stable between 0.8 and 1.

It’s worth noting that for short trades, higher values for MyMultS are needed compared to MyMultL (0.9 vs. 0.4), suggesting more aggressive market movements are necessary in that direction to achieve gains, likely due to the general bullish bias of stock indices favoring long positions over shorts.

This image has an empty alt attribute; its file name is image-2-12.png

Figure 9 – Detailed Equity Curve of the ORB Trading System on the DAX after optimizing MyMultL and MyMultS

This image has an empty alt attribute; its file name is image-13.png

Figure 10 – Strategy Performance Report after optimizing MyMultL and MyMultS

Conclusions on the ORB Trading System for the DAX

As we wrap up this article, it’s fair to conclude that the Opening Range Breakout on the DAX future remains a valid pattern worthy of consideration today.

Is this the final version of the strategy? Definitely not. The strategy still needs further development to be ready for live trading. As highlighted, the average trade should ideally be at least 170-180 euros for the DAX to ensure profitability and cover real trading costs. Additionally, a solution to reduce the maximum drawdown to more manageable levels is needed. Various tools can achieve this, from adding filters to leveraging pattern libraries we use at the Unger Academy® and more sophisticated risk management. Nonetheless, it’s a solid starting point. Now it's up to you, readers, to work on it.

Until next time, happy trading!

Andrea Unger

Market News and Data brought to you by Benzinga APIs
Comments
Loading...
Posted In:
Benzinga simplifies the market for smarter investing

Trade confidently with insights and alerts from analyst ratings, free reports and breaking news that affects the stocks you care about.

Join Now: Free!