Skip to content
Wildflower
Join free
Indicators

Free Trading School · Level 2 · Course 2.4

Median filters, Reflex, Trendflex and the universal oscillator

Lesson 76 of 99 in IndicatorsModule 7: More momentum and volume indicators

Reading the market · Indicators

Median filters, Reflex, Trendflex and the universal oscillator

Wildflower Trading School · Lesson 2.4.7.44

Wildflower

Last time, you met price zones, chaos bands and projection bands. This lesson has five more of John Ehlers' indicators. By the end, you'll know how each is built, and why some of them wait a long time before they have a value.

1 of 11

What you'll learn

  • The median filter. The middle of five closes, smoothed, drawn on price.
  • The median oscillator. That filter with its slow drift taken out, in ticks.
  • Reflex. How far the smoothed line bends from a straight path.
  • Trendflex. How far now sits from the recent smoothed values.
  • The universal oscillator. The change over two candles, set against its fading peak.

Exercise

  1. On any chart, take the last 5 closes.
  2. Sort them and find the middle one, then work out their average.
  3. How far apart are the two, and which candle pulls the average away?

Practise this on Wildflower's free practice chart. It needs a free account.

Join waitlist

Quick check

  1. 1. Why can the universal oscillator never be a condition exit?

  2. 2. On a steady, straight climb, what does Reflex read?

  3. 3. How is a level for the recursive median oscillator typed?

0 of 3 answered.

Finished this lesson?

Tick it off and keep your place

Make a free account and we'll remember where you are, so “The Voss filter and the correlation cycle” is waiting next time.

Read the full notes

Five more of John Ehlers' indicators. The recursive median filter smooths the middle of the last five closes and is drawn on price; its oscillator takes the slow drift out and reads in ticks. Reflex shows how far the smoothed line bends from a straight path, and Trendflex how far now sits from its recent values. The universal oscillator reads from minus 1 to 1. Some wait a long time before they have a value.

  • Five more of John Ehlers' indicators, each written out from the code he published with it. They build on the super smoother and the roofing filter.
  • The takes the middle of the last five closes, like a moving median, so one wild candle can't drag it. Closes of 5,000, 5,003, 5,040, 5,002 and 5,004 have a middle of 5,003, where their average is 5,009.80. Then it smooths that: with a length of 12, it moves 0.42 of the way each candle, so from 5,001 it reads 5,001 + 0.42 × 2 = 5,001.85. It is drawn on price. His code starts it at 0; Wildflower starts it at the first middle, which settles sooner and gives the same line once settled.
  • The is that filter with its slow drift taken out by the roofing filter's two-step high-pass. Swings much longer than the second length you choose are removed, so the line swings around 0. It reads in price, so a level is typed in ticks. On Micro Gold a tick is 0.10, so 8 ticks is 0.80.
  • and smooth the closes with a super smoother over half your length, then look back your length of candles. Reflex adds up how far each smoothed value sits from a straight line drawn from the oldest to now. Trendflex adds up how far now is from each of them. With a length of 4 and smoothed values of 5,000, 5,004, 5,006, 5,010 and 5,012, Reflex's sum is −2 ÷ 4 = −0.5 and Trendflex's 28 ÷ 4 = 7.
  • Each sum is divided by the square root of its own slow average square, which takes 0.04 of each new square and 0.96 of the old. From 25, a Trendflex sum of 7 gives 0.04 × 49 + 0.96 × 25 = 25.96, and 7 ÷ √25.96 = 1.37. So both read about −2 to 2 for long stretches.
  • On a made-up run with a length of 18, while closes climbed 2 points a candle, Trendflex stayed above 0, from 2.13 easing to 1.07, and Reflex read 0 once the climb was straight. Seven candles after the climb stopped, Reflex reached −2.53. Once prices had been flat a while, both read 0.
  • The takes the change in the close over two candles, halved, smooths it over your length, and divides by its own recent peak. The peak fades by 0.991 each candle and jumps up to any bigger swing, so the line runs from −1 to 1. With a peak of 4, the next candle's peak is 3.964, and a smoothed change of 2 reads 0.50.
  • Each feeds back on itself, so each waits until its start has faded to under a millionth: the median filter 27 candles at a length of 12; Reflex and Trendflex about 340 candles plus the length and the smoothing, 415 at 18; the universal oscillator at least 1,550. That's more than the 512 a condition exit reads, so the universal oscillator can never be an exit. Your strategy's copy draws all five on TradingView, NinjaTrader, MetaTrader 5, cTrader and Quantower.

Worked example

Made-up numbers

Reflex and Trendflex, step by step

Made-up smoothed values · a length of 4

  1. The smoothed values were 5,000, 5,004, 5,006, 5,010, and now 5,012
  2. A straight line from 5,000 to 5,012 sits at 5,009, 5,006, 5,003 and 5,000. The gaps from it are −1, 0, −1 and 0, so Reflex's sum is −0.5
  3. Now less each value is 2, 6, 8 and 12, so Trendflex's sum is 28 ÷ 4 = 7
  4. With a slow average square of 25 before, Trendflex reads 7 ÷ √25.96 = 1.37

The line bent a little, so Reflex is near 0, and it climbed, so Trendflex is above 0.

Your turn

Drill

Made-up smoothed values · a length of 3

Trading is risky. You can lose money. This lesson explains how trading works. It isn't advice.