1. Valmy
  2. Learn
  3. Technical analysis
  4. T2

Is this market trending or stuck in a range?

Beginner 11 min read

Short answerA market is trending when price makes net progress in one direction: swing highs and lows keep rising (or falling), a moving average slopes steadily, and most candle-to-candle moves add up instead of canceling. It is ranging when swings stall between a ceiling and a floor, the average flattens and moves cancel. Over ten synthetic candles, a trending series keeps 80% of the distance it traveled and a ranging one about 4%. The answer depends on candle size and lookback, and describes the past only. Decide which condition a rule is built for: buying strength gets whipsawed in a range, and buying dips keeps losing in a downtrend.

Valmy noteValmy's v1 strategy language includes the simple moving average and no other indicator, so the efficiency ratio is taught here for reading charts (as of 26 November 2026).

Three ways to tell a trend from a range#

Traders usually combine three descriptions of the same candles: the pattern of swing highs and lows, the slope of a moving average, and a single number for how efficiently price moved, such as Kaufman's efficiency ratio. Each one needs two choices that change the answer: the candle size (five-minute, hourly, daily) and how many candles to look back. None of them predicts the next move. They summarize what already happened, in a form you can write down and test.

Swing highs and swing lows: higher highs, higher lows#

A swing high is a candle whose high stands above the candles around it. This lesson uses a specific rule: the high must be above the highs of the three candles before it and at least as high as the three candles after it. A swing low is the mirror image, using lows. In an uptrend, each swing high is higher than the last (higher highs) and each swing low is higher too (higher lows). A downtrend shows lower highs and lower lows. In a range, swing highs cluster near one level and swing lows near another.

The rule has a built-in delay. A swing high can be confirmed only after the three candles that follow it have closed, so on a live chart the latest swing is always at least three candles old. A rule that uses swings must wait for that confirmation, or a backtest will use information that was not yet available.

The slope of a moving average#

A simple moving average (SMA) of 20 candles is the average of the last 20 closes. Its slope can be measured as the percentage change in the SMA over a fixed number of candles, for example over the last 20. A steady positive slope means recent closes keep averaging higher. In a range, the slope swings back and forth around zero. Because the SMA averages past closes, it turns after price does. The lesson What does a moving average actually measure? covers its lag in detail.

The SMA is the one indicator in Valmy's v1 strategy language, which also lists lagged values and comparisons among its building blocks (as of 26 November 2026). Valmy evaluates strategies on five-minute candles, so a 20-candle SMA there covers 100 minutes, not 20 days.

Kaufman's efficiency ratio: net progress divided by distance traveled#

The efficiency ratio (ER), which Perry Kaufman described in his book Smarter Trading as part of his adaptive moving average, compares how far price got with how far it traveled to get there. It uses closing prices only:

ER = |close now − close n candles ago| ÷ (sum of the n absolute candle-to-candle changes in the close)

The result has no units and runs from 0 to 1. A value of 1 means every candle moved in the same direction. A value near 0 means the ups and downs canceled out. This lesson uses n = 10 candles, so each value needs 11 closes. Platforms choose different lookbacks: the open-source TA-Lib library computes the same ratio inside its adaptive moving average with a default of 30 candles, so check the setting on any chart you compare.

Calculating the efficiency ratio step by step#

Two ten-candle examples show how the ratio separates progress from back-and-forth movement. Both start at 100.0.

Candle 0 1 2 3 4 5 6 7 8 9 10
Trending closes 100.0 101.0 102.5 102.0 103.5 104.0 105.0 104.5 106.0 107.0 108.0
Ranging closes 100.0 101.5 100.5 102.0 100.0 101.0 99.5 101.0 100.0 101.5 100.5

Trending closes. The net change is 108.0 − 100.0 = 8.0. The ten candle-to-candle changes are +1.0, +1.5, −0.5, +1.5, +0.5, +1.0, −0.5, +1.5, +1.0 and +1.0. Their absolute values add up to 10.0. ER = 8.0 ÷ 10.0 = 0.80: price kept 80% of the distance it traveled.

Ranging closes. The net change is 100.5 − 100.0 = 0.5. The changes are +1.5, −1.0, +1.5, −2.0, +1.0, −1.5, +1.5, −1.0, +1.5 and −1.0, and their absolute values add up to 13.5. ER = 0.5 ÷ 13.5 ≈ 0.04.

The ranging series moved more in total (13.5 against 10.0) but got almost nowhere. That is the distinction the ratio captures, and one that a measure of volatility alone would miss.

How high an efficiency ratio does pure noise produce?#

Pure noise does not give an efficiency ratio of zero. Over ten candles, random ups and downs rarely cancel exactly, so a random price path produces a typical ER(10) of about 0.32. This figure comes from a synthetic random walk of 20,000 candles with no drift, built for this lesson, and matches the rough rule that random net movement grows with the square root of the number of candles: 1 ÷ √10 ≈ 0.32. A single reading of 0.40 is therefore weak evidence of a trend. An average well above 0.32 over many candles, together with rising swings, is stronger.

Two synthetic hourly series, designed for this lesson, show the three measures agreeing. In the trending series, swing highs and lows keep rising, the 20-candle SMA climbs 3.8% over the last 20 candles and the 10-candle ER averages 0.52. In the ranging series, swing highs stay near 104 and swing lows near 96, the SMA slips 0.7% and the ER averages 0.18, below the pure-noise level of 0.32. Each series has 80 candles, and the charts show candles 21 to 80, so the SMA and the ER are available for every candle shown.

Sixty synthetic hourly candles rising from about 106 to 117.60. Gray lines connect swing highs at 106.98, 110.25, 112.53 and 115.41 and swing lows at 105.43, 108.08, 110.79 and 113.80. The orange 20-candle SMA rises steadily. Below, the 10-candle efficiency ratio averages 0.52 and stays above the dashed 0.32 noise line most of the time.
Figure 1. Synthetic data. Each swing high and low is higher than the one before, and the efficiency ratio sits above the pure-noise level on most candles.
Sixty synthetic hourly candles swinging between about 96 and 104. Swing highs sit between 103.93 and 104.01 and swing lows between 95.75 and 96.32. The orange 20-candle SMA waves gently around 100. Below, the 10-candle efficiency ratio averages 0.18 and stays under the dashed 0.32 noise line almost all the time.
Figure 2. Synthetic data. The swings repeat at the same levels, the SMA goes nowhere and the efficiency ratio stays below the pure-noise level.

The three measures agree in this designed pair:

Measure (candles 21 to 80) Trending series Ranging series
Swing highs 106.98, 110.25, 112.53, 115.41: rising 104.01, 103.93, 103.95, 103.96: flat
Swing lows 105.43, 108.08, 110.79, 113.80: rising 95.79, 96.07, 95.75, 96.32, 96.09: flat
SMA(20) change over the last 20 candles +3.8% −0.7%
Average ER(10) 0.52 0.18
Candles with ER(10) above 0.32 77% 7%

Even the clean trend has an average ER of only 0.52, because each pullback gives back part of the previous leg. The individual ER readings in Figure 1 swing from near 1 at the end of a leg to near the noise line during a pullback. Reading the ratio one candle at a time would label parts of a clear uptrend as noise. Averages and swing structure over a longer stretch give a steadier reading.

The same data can trend on daily candles and chop on hourly candles#

Whether a market trends depends on the candle size, because building longer candles cancels out much of the short-term back-and-forth. In the synthetic dataset of Figure 3, daily candles rise 34% in 30 days with a 10-day ER averaging 0.83, while the 10-hour ER on the very same prices averages 0.20, below the pure-noise level. The data are 720 hourly candles made from a small steady upward drift plus hourly noise that keeps pulling back toward the drift, and the same hours are combined into 30 daily candles using the first open, highest high, lowest low and last close of each day.

Top: thirty synthetic daily candles rising from an open of 99.27 to a close of 133.27, with the daily efficiency ratio averaging 0.83. Bottom: the last 48 hourly candles of the same data chopping between 129.97 and 135.92, with the hourly efficiency ratio averaging 0.16 over those hours.
Figure 3. Synthetic data. One dataset, two readings. Notice that the shaded last two days on the daily chart are the same hours as the choppy hourly chart below.

On daily candles, the market rose 34%, from an open of 99.27 on day 1 to a close of 133.27 on day 30, and the daily low was above the previous day's low on 28 of 29 days. The 10-day ER averaged 0.83 from day 11 to day 30, far above the 0.32 noise level. On hourly candles, the 10-hour ER averaged 0.20 over all 720 hours and 0.16 over the last 48, below the noise level. In those last 48 hours, price moved between 129.97 and 135.92 and the close rose only 1.56 (1.2%).

A daily trader calls this an uptrend. An hourly trader looking at the last two days calls it a range. Both describe the data correctly at their own scale. The useful question is which scale a rule acts on. Valmy's strategies are evaluated on five-minute candles, so a trend that is obvious on a daily chart has to be translated into a rule on five-minute candles, where the same move can look like noise.

What could change the conclusion about a trend or range?#

A trend or range label depends on choices that a different trader might make differently, so the same chart can support competing readings. Before relying on the label, check these:

  • Lookback. Ten candles and fifty candles can disagree. A pullback inside a trend looks like a downtrend over a short lookback.
  • Swing rule. Requiring three candles on each side finds fewer, larger swings than requiring one. A trader using one-candle swings sees many more lower highs.
  • Start and end points. Measuring from the bottom of a sell-off makes any recovery look like a strong trend.
  • Confirmation delay. Swings are confirmed only after later candles close, and the SMA turns after price does. By the time a trend is confirmed, part of the move is over.
  • Regime change. A trend can end in a range, and a range can end in a breakout. The lesson When does a breakout fail? shows how a move out of a range can reverse.
  • Flat data. If the close does not change for ten candles, the ER formula divides zero by zero. Implementations treat this differently: TA-Lib's adaptive moving average sets the ratio to 1, while the calculation behind this lesson's charts reports 0.

The average directional index measures trend strength in a different way, from highs and lows instead of closes, and is covered in How strong is this trend? ADX, the directional indicators and Aroon.

Research finds that trends have tended to persist on average across many markets, but averages say little about any single chart. Moskowitz, Ooi and Pedersen (2012) studied 58 liquid futures and forward contracts on equity indexes, currencies, commodities and government bonds, with their main results covering January 1985 to December 2009. An instrument's return over the past 12 months positively predicted its return over the next month, the effect lasted about a year and then partly reversed, and a 12-month trend strategy was profitable in every one of the 58 contracts over that period. Liu and Tsyvinski (2021) report a strong time-series momentum effect in cryptocurrency returns as well.

These are averages over many instruments, years and monthly returns. They do not say whether the trend on a particular chart will continue tomorrow, they do not cover five-minute candles, and a positive average leaves room for long losing stretches. Treat them as a reason to take trends seriously, not as a forecast.

Check your understanding: measuring a trend over ten candles#

Question. A token's hourly closes over eleven candles are 50.0, 50.6, 50.2, 51.0, 51.4, 51.1, 51.8, 52.4, 52.0, 52.7 and 53.0.

  1. What is the efficiency ratio over these ten candle-to-candle changes?
  2. Using closes and a one-candle rule (a close above, or below, both neighbors), are the swings rising?
  3. Another trader looks at the same token on daily candles and finds an ER(10) of 0.12. Who is right about the trend?
Show the answers

Answer.

  1. Net change = 53.0 − 50.0 = 3.0. The absolute changes are 0.6, 0.4, 0.8, 0.4, 0.3, 0.7, 0.6, 0.4, 0.7 and 0.3, which add up to 5.2. ER = 3.0 ÷ 5.2 ≈ 0.58, well above the pure-noise level of about 0.32.
  2. Yes. The swing highs are 50.6 (candle 2), 51.4 (candle 5) and 52.4 (candle 8), and the swing lows are 50.2 (candle 3), 51.1 (candle 6) and 52.0 (candle 9): higher highs and higher lows. With only eleven candles, this is a short sample, and a one-candle rule finds swings that a three-candle rule would ignore.
  3. Both can be right. Eleven hours of steady gains can sit inside a daily range, just as Figure 3 showed a daily trend containing choppy hours. The reading that matters is the one on the candle size and lookback your rule acts on, and neither reading says what happens next.