John Ehlers Sinewave

John Ehlers Sinewave

This is an implementation of John Ehlers’ Sinewave Indicator, as described in Market Mode Strategies (1999-10-19).

This is a different and earlier version of the Sinewave Indicator, from what is described in John Ehlers’ books Rocket Science for Traders (2001-07-20) and Cybernetic Analysis for Stocks and Futures (2004-03-29). However, this is the most popular version of the algorithm and seems to achieve better results.

A more recent formula of Hilbert Transform, described in Squelch those Whipsaws (2000-24-03), can be used, by replacing the beginning of the code with:

The attached screenshot shows the Sinewave Indicator using original description (top) of and the alternative Hilbert Transform formula (bottom).

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

New! PRC is also now on YouTube, subscribe to our channel for exclusive content and tutorials

  1. cbeukes • 355 days ago #

    Very interesting indicator. Any advice on identifying the transition between ranging and trending markets?

    • Horance • 355 days ago #

      This is a good question. John Ehlers explains it in Rocket Science for Traders. You have to use the Sinewave Indicator in conjunction with the Instantaneous Trendline (https://www.prorealcode.com/prorealtime-indicators/john-ehlers-instantaneous-trendline/). Basically, when the trendline crosses the Kalman filter, we start to count the number of bars. While the number of bars is inferior to half a period, we stay in cycle mode, otherwise we enter trend mode.

  2. cbeukes • 352 days ago #

    Much appreciated, I will give that a try. Also, is there any criteria that one could use to identify whether if a sinewave cycle cross is valid? Perhaps the level of an RSI or Stochastic using the cycle period as calculated above?

  3. firemyst • 129 days ago #

    Thanks for the code! I’m trying to understand how it works, and have a few questions… lines 16 & 17: howdoes InPhase[3] and Quadrature[2] have any values? Any indexes below 6 aren’t assigned. So, those values just return zero? Same with the Value3[4] array. What value does Value3[4] have from 4 bars ago? High? Low? Close? Nothing?

    Thank you 🙂

avatar
Register or

Likes

avatar avatar avatar avatar avatar
Related users ' posts
ALE :-) thanks
Santi Hola amigos. El indicador con la nueva versión de PRT funciona muy mal, no dibuja igual que ...
Santi Salut, les amis. L'indicateur avec la nouvelle version de PRT 11 fonctionne très mal, ne fon...
Nicolas Thanks again for all your valuable posts... and well formatted code! :)
Abdelkrim Maksour hi sir is this indicator for mt4 and how i can get one .
Nicolas Thanks a lot for this new valuable addition to our library. I changed line 76 with "barindex...
Horance Thanks. I've noticed this leftover after submission, but it was too late for editing. BTW, I...
Etienne Thanks Horance for porting this code to PRT. I would like to bring some speedup to your cod...
Bebbo Grazie del prezioso contributo Nicolas, scusa la mia inesperienza, sono alle prime armi e s...
Nicolas To avoid recalculation, you should use the one from this post.
Bebbo Ok Grazie Nicolas.
Appsoluxions Hi Nicolas, do you have the MT4 version of the indicator? I am not sure if these kind of que...
Nicolas Hi, don't have one sorry. But you can still ask for private coding through our programming s...
Appsoluxions Cool. Thanks for the response.
Etienne Hi, thanks for proving this code. I would like to contribute by adding a computation speed...
Etienne //Compute Super Smoother coefficients once if barindex = 1 then a1 = exp( -1.414 * 3.14159...
Nicolas Thanks a lot!
Bard From the url link #post-65420 above but without the chart image: Stocks & Commodities...
Bard Note: lter = filter
Bard Apologies, there's been an issue with copying "f" and "I" from the article and pasting.. whi...
Nicolas
2 years ago
macbartin merci, possible de l'utiliser seul pour le faire fonctionner en tant que stratégie ? de même...
Nicolas Oui. Pour changer la période, il faudra ajuster la variable MMperiod
macbartin plus la période est grande (en occurrence 20) plus l'indicateur est précis dans les changeme...
Alai-n Ok thank you Pietro...
Halan thank you for the code. coded as per above, I encounter an error "unexpected character" ...
Gianluca Hello there is a new version, is it possible to translate it? https://www.tradingview.com...
vitatrader35 Hola, Diego Puedes explicar cómo lo usas? Estoy tratando de emplearlo como validación de te...
diegofe_2000 Compra a la baja :  cruce de MEAN sobre AVG PEAK Compra al alza :   cruce de MEAN con AVG...
andrea ronca hi, do you know the best configuration for period, delta and fraction? thanks in advance
Bard P.s. is there anyway of getting more, 4 hour £/€ data to back test on (or other currency pai...
Etienne Hi, I'm quite late in this thread. I'd just like to propose an enhancement because this in...
Nicolas Thanks Etienne.
Nicolas
4 years ago
supertiti Bonjour à tous, Pour ceux qui veulent adoucir ce filtre on peut lui adjoindre une moyenne m...

Top