Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Note that the version Cory posted and I updated seems to be based on the code in John Ehlers' book, Cybernetic Analysis for Stocks and Futures. There is what appears to be a different version in one of his other books, Rocket Science for Traders. That one had some very minor differences in the input smoothing but the only significant difference is that the Rocket Science version had some typos that were not corrected in the Sine Wave that was on the Ninjatrader forum.
So there really should be only one version of this indicator, as the Cybernetics Analysis and Rocket Science versions are the same animal, both based on the Hilbert Transform.
For test purposes I am adding code to various indicators to measure the actual backfill time to the millisecond. It appeared that drawingsupport and resistance lines (using DrawText method) on the price panel caused unacceptable performance issues, increasing the backfill time from a few milliseconds to ten or more seconds. The solution would be to use one indicator to plot the sine wave in an indicator panel, and another indicator to PLOT, not DRAW, the support and resistance lines in the price panel. In this case at least, the DrawText method seems to be a voracious resource hog. Harry @Fat Tails had already mentioned this, but the resource hit is not minor... it is a disaster.
To further confuse the issue, there is the new Even Better Sine Wave in the latest Ehlers book, Cycle Analytics for Traders.
@noyss, could you share the code for the TOS version, preferably as a text file?
"If we don't loosen up some money, this sucker is going down." -GW Bush, 2008
“Lack of proof that something is true does not prove that it is not true - when you want to believe.” -Humpty Dumpty, 2014
“The greatest shortcoming of the human race is our inability to understand the exponential function.” Prof. Albert Bartlett
I fixed the version of the Sine Wave that was posted on the Ninjatrader forums.
The program logic flow was wrong. Now, for the first time, the Rocket Science version plots correctly. Now it is actually usable.
It really is essentially the same as the Cybernetics Analysis version except for additional input smoothing options which may not improve the usefulness of the results anyway.
The Cybernetics version is three years newer than the Rocket version.
I did NOT fix the ridiculously inefficient code that was MINDLESSLY copied from the books. After fixing that, another possibility is an MTF version that will work on a time frame other than that of the chart master instrument.
The time needed for the indicator to backfill the historical bars prints to the output window.
"If we don't loosen up some money, this sucker is going down." -GW Bush, 2008
“Lack of proof that something is true does not prove that it is not true - when you want to believe.” -Humpty Dumpty, 2014
“The greatest shortcoming of the human race is our inability to understand the exponential function.” Prof. Albert Bartlett
I tried the EasyLanguage version of Ehler's "Even Better Sine Wave" indicator and I get a "floating point invalid operation" error message. I believe I have been faithful to the original. Any thoughts as to what I'm doing wrong here?
//High pass filter cyclic components whose periods are shorter than duration input
HP = 0.5*(1 + alpha1)*(CLOSE - CLOSE[1]) + alpha1*HP[1];
//Smooth with a Super Smoother Filter
Filt = c1*(HP + HP[1])/2 + c2*Filt[1] + c3*Filt[2];
//3 Bar average of Wave amplitude and power
Wave = (Filt + Filt[1] + Filt[2])/3;
Pwr = (Filt*Filt + Filt[1]*Filt[1] + Filt[2]*Filt[1])/3;
//Normalize the Average Wave to Square Root of the Average Power
IF PWR <> 0 THEN
Wave = Wave/SquareRoot(Pwr);
I am quite new to this forum and have stumbled upon this topic by pure accident, but maybe it would be useful for you to share my experiences.
I have only limited experiences in trading, but was fascinated by Ehlers approaches some years ago. About two years ago, I started working on the different versions of Ehlers Sinewave indicators, first using Excel, later up to now MT5. Beginning with the Homodyne from Rocket Science, the Deltaphase from one of his later books (can't remember the title right now) and the Better Sine Wave from one of his last books. Since I have been professionally involved in Fourier Analysis long years ago, I have even been able to develop my own sinewave indicators, using the same maximum entropy algorithm Ehlers is claiming to use in his Mesa indicators. My indicators include variable lookback periods and nice spectrum displays. (Unfortunately I can't post a screenshot due to the resitrictions of this forum for newbies...)
To my experience, all indicators of this type are working great in a stable cycle mode.... but only there. One of the reasons is, that they are lagging due to a lot of necessary smoothing and detrending. If I remember correctly, the Homodyne lags about 20 bars. The complex calculations all try to extract the period of the so called "Dominant Cycle" from the price data, which takes about 20 bars or more. So the output is an average DC valid during the past 20 bars. The assumption for trading (and plotting the support and resistance lines) is, that this DC will continue in the future.
Unfortunately, to my limited experience, in a lot of cases this assumption will fail.
So I would recommend the homodyne based sine wave indicator as a useful confirming signal, excellent during cycle modes, but be very careful during trend modes, esp. during downtrends. My attempt was to use it in an automated trading system, but I have not been able to be profitable so far. I have only very limited experience in trading, maybe I simply have not been able to find a currency pair with useful cycle modes or a successful combination with other indicators.