Range trades can be a very effective strategy and are used widely by professionals.
But detecting suitable ranges in charts is the main challenge. Firstly ranges tend to be fluid and continually evolving. Secondly most range finding tools are graphical “shape drawing” utilities which don’t produce any outputs that can be traded on.
These limitations make them of little use for real trading.
Given the above challenges how exactly do we trade ranges profitably? More precisely:
- How do we identify if the market is ranging?
- How do we know where the price is within a given range?
- How do we estimate the probability of a price breakout?
- How do we do this without watching the market 24×5?
This article describes a strategy for trading ranges using adaptive linear regression channels. Adaptive linear regression is a statistical method that can solve these problems. It does this by fitting the price to a chain of channels with each being the optimum fit.
As a benchmark I started with a naïve model that just bought and sold at certain positions in the leading range. This strategy produces good profits for a variety of market conditions and is suited to general use (see results).
I refined the basic strategy to use trending properties and to avoid trading against significant resistance or support levels. The extended model reduced the number of trades but in doing so increased trade profitability.
Why do prices range?
Firstly, let’s try to understand why prices range and under what conditions.
It’s well known that when financial markets are volatile prices tend to overshoot or undershoot fair value. A range is simply the upper and lower confines of these price variations.
Range trading also known as channel trading, means simply to trade the price between these given boundaries. The philosophy behind this is that history repeats more often than not. And that the highest probability state is that the price will tend to remain within the same confines. This being until some event causes a shift in market outlook after which a breakout of the channel can occur.
This “wave effect” of ranges is reinforced by both fundamental and technical traders who attempt to buy at the bottom of the range and sell at the top.
The classic picture most have of a range is a horizontal channel. But it’s also very common for ranges to be superimposed on trends. These give rise to either upwards or downwards sloping channels. Moreover ranges don’t have to be rectangular. They can also be wedge shaped or curved.
In this sense, markets can be said to be “ranging” at one scale or another nearly all of the time.
When I first looked at this I wanted to come up with a strategy that would dynamically adapt to the market and could be easily automated.
Standard range finding tools such as those in Metatrader will help you to visually identify ranges. But the problem is these are graphical objects that have to be moved around by hand. They also don’t produce any useful outputs that can be traded on.
A workable range trading strategy requires a more sophisticated setup. It needs to be able to find ranges without guidance and adapt dynamically as they change over time.
To overcome this we created an adaptive linear regression indicator and built a range strategy EA around this.
Briefly, standard linear regression is a statistical method for measuring the relationship between two variables. In our case these are price vs. time. See Figure 2. The linear regression model can tell us for example:
- When the market is following a predictable price channel
- The statistical properties of the channel: trend, time, volatility, rate of change
- An estimate of the future price path
- When the price is breaking out of the existing channel
We make this adaptive so that the model parameters are able to change as the price line evolves. This produces a continuous set of ranges of “best fit”.
The aim of this strategy is to exploit range properties and in doing so produce trades with good risk adjusted returns. These goals are as follows:
- Identify lines of high resistance or support
- Identify the “central axis” of the range
- Identify the “range stability”.
- Identify “pitch influences” from major ranges that will impact current prices
Let’s look at these individually.
1. Finding Lines of Resistance and Support
The most likely price pivot points occur at or near the range boundaries. But ranges of any size usually have several other key pivot areas. These include the central axis. In bigger ranges they also include the lines of standard deviation which will mark zones of strong price support and resistance.
For example Figure 3 above shows EURGBP on the hourly chart. The two bold lines mark a distance of 1 standard deviation from the central range axis. These are clearly acting as strong support and resistance. But looking closely you can see that the price is also pivoting at the 0.5 standard deviation lines as well.
Standard deviation measures the width or price movement of the range. Basically a range with a high standard deviation is wide, and one with a low standard deviation is narrow. See Figure 4.
2. Identify the Central Axis
The central axis is the main pivot line of the range. In linear regression, the central axis is also the line of best fit.
Knowing the range’s central axis is important for two reasons. Firstly it gives you a baseline to check if the price is trading on the lower side or upper side of the range. For a prominent range, mean reversion becomes important. What this means is that the price will tend to migrate back towards the central axis (the mean) of the range.
The second reason for identifying the central axis is that it tells you the general direction in which the price is trending.
To find the position within the range we set the indicator up to display the distance in standard deviations from the central pivot line. This is the orange line shown in the sub window of Figure 5. For example when the line is at zero the price is exactly at the central pivot line. At +1 it’s at the upper standard deviation. At -2 it’s two standard deviations below the central line and so on.
Also in the lower window in Figure 5 the green line flags when a grid crossing (or bounce) occurs and the blue line shows the slope of the range.
3. Identify the Range Stability
Ranges that are well established over time will give stronger support and resistance to price movements than will “short-lived ranges”. For this reason, the extent of the range is a valuable input to the trading system.
For example, Figure 6 shows a range in GBPUSD on the daily chart (D1). The range lasts for 185 days. Compared to the average of 31 days this is obviously an important structure. Flips between ranges are marked by the range transition line (see Figure 6).
4. Identify Pitch Lines
This relates to point 3 above. If we drill down to the 30 minute timescale (M30) from the above daily chart we can see that this “mega range” has an influence long after it appears to break away from the main channel.
Figure 7 shows the M30 chart for July of the same year. The lines drawn on the chart are those extended from the range in Figure 6 above.
These are known as pitch lines and what the diagram shows is that they have an influence on the price right down to the minute scale. This influence extends long after the original trend has apparently broken.
These “invisible forces” can work against the current price direction. In the example shown in Figures 6 and 7 the market is trying to break upwards and out of this strong downwards channel.
But the pitch lines from the dominant range (in Figure 6) act as strong resistance to upwards progression of the newly forming trend. The strength of pitch lines reduces the further they are from the central axis of the range. Eventually either the new trend will win over or the original will reassert itself.
Naïve trading model
As a benchmark we started with a naïve strategy that just bought and sold at certain positions in the leading range. Basically this “sells” the top of the range channel and “buys” the bottom.
We used the hourly (H1) chart and the minimum range length was set to 50 bars. The back test covers a period of 10 years and the spread was set to 21 points. The tests traded one standard lot per trade and used fixed leverage at 1:1.
The naïve strategy is as follows:
SD < –dx1 and SD >-dx2 ⇒ Buy
SD > dx1 and SD < dx2 ⇒ Sell
dx2 > dx1
Here SD is the price distance (in standard deviations) from the central axis of the front channel and dx 1 and dx 2 are input parameters.
Extended trading model
In the next test we used the pitch lines. This was to avoid trading “into” resistance and support levels on the daily scale (D1). We also included the gradient (slope) of the range as an input – thus avoiding trading against strong trends.
To identify pitch lines the strategy uses a second instance of the indicator at the daily scale (D1).
The extended model reduced the number of trades by nearly one half versus the naïve model. But the profit factor increased to 1.46 from 1.29 with the extended model. The overall profit was also significantly higher at $306k.
A free version of the range trade indicator is available here:
The EA (expert advisor) for this strategy will also be available shortly.