Hilbert sine wave indicator - futures io
futures io futures trading



Hilbert sine wave indicator


Discussion in NinjaTrader

Updated by blackfriday
      Top Posters
    1. looks_one Zondor with 10 posts (58 thanks)
    2. looks_two cory with 8 posts (14 thanks)
    3. looks_3 ntsst3 with 7 posts (3 thanks)
    4. looks_4 noyss with 6 posts (2 thanks)
      Best Posters
    1. looks_one Fat Tails with 7.0 thanks per post
    2. looks_two Zondor with 5.8 thanks per post
    3. looks_3 vegasfoster with 4.5 thanks per post
    4. looks_4 cory with 1.8 thanks per post
    1. trending_up 59,929 views
    2. thumb_up 134 thanks given
    3. group 39 followers
    1. forum 77 replies
    2. attach_file 27 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Hilbert sine wave indicator

(login for full post details)
  #71 (permalink)
Ibiza. Spain
 
Experience: Intermediate
Platform: MT4
Broker: Darwinex
Trading: EminiSP, Crude, Euro/Dolar, Bitcoin.
 
noyss's Avatar
 
Posts: 76 since Jul 2012
Thanks: 121 given, 32 received


Zondor View Post
They SHOULD, work exactly the same, unless the second one has coding errors.

[/URL]


Did you refer to the __Oscillator_HilbertSinewave?

As you can see, __Oscillator_HilbertSinewave doesn´t plot support and ressistance as good as your first one

Reply With Quote

Can you help answer these questions
from other members on futures io?
T​​​​​​radestation datafeed (real time and historical) to NT8
NinjaTrader
Help tracking down catalysts for the ES
Traders Hideout
EQIX - Digital REITs - any experiences?
Stocks and ETFs
Need a near crosses scan help for TOS
ThinkOrSwim
GBP/ARS Pair
Traders Hideout
 
 
(login for full post details)
  #72 (permalink)
Portland Oregon, United States
 
Experience: Beginner
Platform: Ninjatrader®
Broker: CQG, Kinetick
Trading: Gameplay Klownbine® Trading of Globex
 
Zondor's Avatar
 
Posts: 1,346 since Jul 2009
Thanks: 1,245 given, 2,713 received

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.

The corrections to the Rocket Science version are here (the real and imaginary parts got interchanged): https://www.mesasoftware.com/bookcompanions.htm
 
Code
pages 98 and 102 and 116 and 120 & 121: the code should be corrected to be: 
....... RealPart = RealPart + Sine(360*count/DCPeriod)*(SmoothPrice[count]); 
....... ImagPart = ImagPart + Cosine(360*count/DCPeriod)*(SmoothPrice[count]); 
....... If AbsValue(ImagPart) > 0 then DCPhase = Arctangent(RealPart/ImagPart); 
....... If AbsValue(ImagPart) <= .001 then DCPhase = DCPhase + 90*Sign(RealPart):
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 drawing support 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
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Zondor for this post:
 
(login for full post details)
  #73 (permalink)
Portland Oregon, United States
 
Experience: Beginner
Platform: Ninjatrader®
Broker: CQG, Kinetick
Trading: Gameplay Klownbine® Trading of Globex
 
Zondor's Avatar
 
Posts: 1,346 since Jul 2009
Thanks: 1,245 given, 2,713 received


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
Attached Files
Register to download File Type: cs _____NTForumSineWave.cs (27.6 KB, 481 views)
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following 18 users say Thank You to Zondor for this post:
 
(login for full post details)
  #74 (permalink)
Boston, MA
 
Experience: Intermediate
Platform: MultiCharts, TradeStation, NinjaTrader, ThinkorSwim
Trading: ES
 
Posts: 26 since Jul 2011
Thanks: 16 given, 13 received

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?



var:
alpha1(0), HP(0), a1(0),b1(0),c2(0),c3(0), Filt(0), c1(0), count(0), wave(0), pwr(0);


alpha1 = (1 - sine(360/40))/ cosine(360/40);
a1 = expvalue(-1.414*3.14159/10);
b1 = 2*a1*cosine(1.414*180/10);
c2 = b1;
c3 = -a1*a1;
c1 = 1 - c2 - c3;


//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);

PLOT1(WAVE);

Reply With Quote
 
(login for full post details)
  #75 (permalink)
Boston, MA
 
Experience: Intermediate
Platform: MultiCharts, TradeStation, NinjaTrader, ThinkorSwim
Trading: ES
 
Posts: 26 since Jul 2011
Thanks: 16 given, 13 received


tortoise View Post
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?



var:
alpha1(0), HP(0), a1(0),b1(0),c2(0),c3(0), Filt(0), c1(0), count(0), wave(0), pwr(0);


alpha1 = (1 - sine(360/40))/ cosine(360/40);
a1 = expvalue(-1.414*3.14159/10);
b1 = 2*a1*cosine(1.414*180/10);
c2 = b1;
c3 = -a1*a1;
c1 = 1 - c2 - c3;


//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);

PLOT1(WAVE);

Never mind. Fixed it.

Yikes, this is indicator really blows. Lol.

Reply With Quote
 
(login for full post details)
  #76 (permalink)
SINGAPORE
 
 
Posts: 1 since Sep 2015
Thanks: 0 given, 0 received

Hi Tortoise,

I am running into the same problem and been scratching my head off, how do you fixed the floating point issues?
Many thanks,

Reply With Quote
 
(login for full post details)
  #77 (permalink)
Frankfurt Germany
 
 
Posts: 5 since Apr 2014
Thanks: 0 given, 3 received

Hi,

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.

Reply With Quote
The following 2 users say Thank You to blackfriday for this post:
 
(login for full post details)
  #78 (permalink)
Frankfurt Germany
 
 
Posts: 5 since Apr 2014
Thanks: 0 given, 3 received


tortoise View Post
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?



var:
alpha1(0), HP(0), a1(0),b1(0),c2(0),c3(0), Filt(0), c1(0), count(0), wave(0), pwr(0);


alpha1 = (1 - sine(360/40))/ cosine(360/40);
a1 = expvalue(-1.414*3.14159/10);
b1 = 2*a1*cosine(1.414*180/10);
c2 = b1;
c3 = -a1*a1;
c1 = 1 - c2 - c3;


//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);

PLOT1(WAVE);


Try

HP = (1 - alpha1 / 2)*(CLOSE - CLOSE[1]) + alpha1*HP[1];

Reply With Quote
The following user says Thank You to blackfriday for this post:


futures io Trading Community Platforms and Indicators NinjaTrader > Hilbert sine wave indicator


November 20, 2015


Upcoming Webinars and Events
 

Dealing with burnout w/Linda Bradford Raschke

Elite only
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts