Most oscillators have one blind spot. They keep flashing overbought and oversold signals even when the market has stopped swinging and started trending, and that is where traders get chopped up. The Ehlers sinewave indicator was built to deal with exactly that problem. It does two jobs at once: it tries to call cycle peaks and valleys a little before they happen, and it goes quiet when the market switches into a trend. That second job is the more useful one, and it’s the part most people skip.
John Ehlers, who has spent decades applying digital signal processing to trading, laid out the logic in a 1996 Technical Analysis of Stocks & Commodities article called “Stay In Phase”. Everything below starts from that article and his later paper on phase-based cycle analysis, both written by Ehlers himself.
In this article
- What “phase” means, in plain words
- How the Ehlers sinewave indicator is built
- Why the lines stop crossing in a trend
- A worked example with a hypothetical 20-bar cycle
- A note on which line “crosses above”
- Ehlers’ later version: reading phase directly
- How the cycle period ties into the speed of phase
- Using it on Nifty stocks without fooling yourself
- Where the Ehlers sinewave indicator falls short
- The short version
What “phase” means, in plain words
Ehlers’ whole approach rests on one idea: phase tells you where you are inside a cycle. Are we at the start, the middle or the end? Every cycle runs through 360 degrees before it starts again. So if a market has a clean 10-day cycle, the phase moves forward at 36 degrees a day, every day, until the cycle completes. That is the example Ehlers uses in the 1996 article.
He pictures it as an arrow bolted to a spinning shaft. Each full turn of the arrow is one cycle. Put a pen on the tip and pull a sheet of paper under it at a steady speed, and the pen draws a sine wave, the familiar up-and-down shape we see on charts. The angle of the arrow at any moment pins down exactly where you are on that wave.
How do you measure the angle from real prices? Ehlers’ method correlates prices over one full cycle against a sine and a cosine. That gives two components at right angles to each other. Take the arctangent of their ratio and you have the phase angle. Your charting software does this arithmetic for you; the point is to understand what the number represents.
How the Ehlers sinewave indicator is built
Once you have the phase, the indicator itself is simple. It plots two lines:
- Sine: the sine of the measured phase angle.
- Lead sine: the sine of the same phase angle pushed forward by 45 degrees.
The thinkorswim platform’s MESA Sine Wave reference describes the same two plots, calling them the Sine Wave and the Lead Wave, with the lead plot being the phase advanced by 45 degrees.
Why 45 degrees? Because the lead line runs a little ahead of the main line. When the market really is cycling, the two lines cross shortly before each peak and each valley. In Ehlers’ words from the 1996 article, that gives you time to act and catch the whole swing rather than reacting after the turn is obvious.
The sinewave’s best trick isn’t the crossover. It’s the crossover that never comes when a trend is running.
Why the lines stop crossing in a trend
This is the clever bit. In a trend there is no real cycle, or only a weak one, so the measured phase barely moves from one bar to the next. If the phase isn’t moving, the two lines, separated by a fixed 45 degrees, never get the chance to cross. Ehlers points out that this is how the indicator avoids the false whipsaw signals that oscillators like the stochastic and RSI tend to throw in trending markets.
The thinkorswim reference describes the visual: when the two plots look like a sine wave, the market is in cycle mode; in trend mode they tend to drift sideways near zero, running parallel and apart from each other.
Ehlers also gave a number for it. In the 1996 article he called a market trending when the measured rate of change of phase is less than 67% of the theoretical rate for the dominant cycle. In other words, if a 20-bar cycle should be moving the phase forward by 18 degrees a bar and it’s only moving 5, the cycle has broken down and a trend has taken over.
A worked example with a hypothetical 20-bar cycle
Let’s make this concrete. The numbers below are hypothetical and come straight from the trigonometry, not from any real stock or index. Assume a market with a perfect 20-bar cycle. A full cycle is 360 degrees, so the phase moves forward 360 / 20 = 18 degrees per bar. Using the convention in Ehlers’ 1996 article, where the cycle’s peak is at 90 degrees, the valley sits at 270 degrees.
Here is how the two lines behave as the cycle approaches its valley:
| Bar | Phase (degrees) | Sine = sin(phase) | Lead = sin(phase + 45) | Which line is higher |
|---|---|---|---|---|
| 1 | 198 | -0.309 | -0.891 | Sine |
| 2 | 216 | -0.588 | -0.988 | Sine |
| 3 | 234 | -0.809 | -0.988 | Sine |
| 4 | 252 | -0.951 | -0.891 | Lead |
| 5 | 270 | -1.000 | -0.707 | Lead |
| 6 | 288 | -0.951 | -0.454 | Lead |
| 7 | 306 | -0.809 | -0.156 | Lead |
Look at bars 3 and 4. The lead line has been falling with the sine line, bottoms out first, and crosses above it between bar 3 and bar 4. The two lines are exactly equal at a phase of 247.5 degrees, which is 22.5 degrees, or about 1.25 bars, before the actual valley at 270 degrees on bar 5. That is the “early warning” in action: the signal arrives just before the low, not after it.
The same thing happens in reverse at the top. The lines meet again at 67.5 degrees, about 1.25 bars before the 90-degree peak, with the lead line now crossing below the sine line. Because the lead is always 45 degrees ahead, the crossing always lands half that distance, 22.5 degrees, ahead of the turn when the cycle is clean.
Now the trend test. The theoretical rate for our cycle is 18 degrees a bar, and 67% of that is about 12.1 degrees. Suppose over the next stretch the measured phase only creeps forward by 5 degrees a bar. That’s roughly 28% of the expected rate, well below Ehlers’ 67% line, so we treat the market as trending and ignore any crossover signals until the phase starts moving properly again.
A note on which line “crosses above”
Platforms don’t all word the signal the same way. In our table, the bullish event near the valley is the lead line rising through the sine line. The thinkorswim reference, though, describes its buy signal as the Sine Wave crossing above the Lead Wave. Labelling and plotting conventions differ between software packages, so before you trade it, put the indicator on a chart, find a clear past valley and check which line turns first. Five minutes of checking saves you from trading the signal backwards.
Ehlers’ later version: reading phase directly
Ehlers kept working on the idea. In “Recurring Phase of Cycle Analysis”, written for the magazine’s 40th anniversary, he plots the phase angle itself instead of its sine. In that version the phase runs from -180 to +180 degrees, the cycle valley is at -90 degrees and the peak is at +90 degrees. The example code in the paper uses a default correlation period of 28 bars.
His swing rules there are straightforward: hold a long position while the phase is between -90 and +90 degrees, and be short or out when it’s above +90 or below -90. He also tightened the trend definition. He treats the market as trending when the derived cycle period is longer than 60 days, which he says works out to the phase advancing 6 degrees per bar or less. And in a trend, the rules flip: you want to be long when the phase is above +90 or below -90, and out or short when it’s between the two.
The paper also makes a point that matches what we see on Indian charts. Measured cycle periods jump around a lot, and Ehlers says it is much better to work in terms of phase than in terms of cycle length. That’s a useful warning for anyone who has tried to trade a fixed “21-day cycle” on a stock and watched it fall apart.
If the phase stalls, the cycle is gone. Stop trading turns and start respecting the trend.
How the cycle period ties into the speed of phase
Ehlers’ paper on the MESA Adaptive Moving Average gives a handy pair of numbers for intuition. A 36-bar cycle moves the phase 10 degrees per bar, while a 10-bar cycle moves it 36 degrees per bar. Shorter cycles mean faster phase. He also notes that cycle periods tend to be longer when the market is in trend mode. Put those together and the sinewave’s behaviour makes sense: as a trend develops, the phase slows, the lines flatten and the crossings dry up.
Using it on Nifty stocks without fooling yourself
A few practical habits help when you put this on a daily chart of a Nifty 50 stock or the index itself:
- Use it as a mode filter first. Before you look at a crossover, ask whether the two lines have been oscillating smoothly. If they’ve been drifting flat and parallel, the indicator is telling you there’s no cycle to trade.
- Pair it with a trend tool. When the sinewave says “trend”, you still need something to tell you the direction. A moving average or the slope of price works. The sinewave on its own won’t tell you whether to buy the trend or sell it.
- Expect fewer signals. On a clean cycle you’ll get roughly two crossings per cycle, one near each turn. Long quiet stretches are the indicator working, not failing.
- Watch out for gaps and news days. Results announcements and big overnight gaps can knock the phase measurement around for several bars. Give it time to settle before trusting a fresh crossover.
- Combine it with other cycle tools. If you already use the Fisher Transform, another Ehlers indicator, or the Detrended Price Oscillator, check whether they agree that the market is cycling before you act on a turn.
Where the Ehlers sinewave indicator falls short
No indicator is clairvoyant, and this one depends heavily on how well the dominant cycle is measured. If two cycles are present at once, Ehlers himself shows that the phase stops advancing uniformly. In his 1996 Deutschemark futures example, that is exactly what pushed the market into trend mode for April and May. Real stocks often carry several overlapping cycles, so expect messy readings.
There’s also the lag problem. Phase is measured over a window of past prices, so after a sharp reversal the indicator needs a few bars to catch up. And because different platforms calculate the dominant cycle in different ways, the same stock can show slightly different crossing dates on two pieces of software. Treat the signal as a timing aid that narrows the window, not a precise forecast.
Finally, the 67% and 6-degree trend thresholds are Ehlers’ working rules from his own testing. They’re a sensible place to start, but backtest them on the stocks you actually trade before you rely on them.
The short version
The sinewave indicator turns the phase of the dominant cycle into two lines that sit 45 degrees apart. When the market is genuinely cycling, their crossings come shortly before peaks and valleys. When it’s trending, the phase stalls and the crossings stop, and that silence is the signal to switch from swing trading to trend following. For a wider grounding in how indicators like this fit together, our guide to technical analysis for Indian stocks is a good next read.
Disclaimer: This article is for education only and is not investment advice. The 20-bar cycle and all figures in the worked example are hypothetical. Indicators can give false signals; do your own research and consult a SEBI-registered adviser before trading.





Leave a Reply
Join the conversation
Commenting is open to registered readers. Sign up with just your email — no password needed, and it takes under a minute.
Sign up to comment Log in