NexusFi: Find Your Edge


Home Menu

 





Hilbert sine wave indicator


Discussion in NinjaTrader

Updated
      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 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 82,174 views
    2. thumb_up 134 thanks given
    3. group 38 followers
    1. forum 77 posts
    2. attach_file 27 attachments




 
Search this Thread

Hilbert sine wave indicator

  #31 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090

per request, add bull/bear series to be used in strategy according to Ninja sample, don't know if it works (for strategy)or not.
looks at ninja sample first to get the idea before calling it from my indi.

Attached Files
Elite Membership required to download: HilbertSW.cs
Elite Membership required to download: SampleBoolSeries.zip
Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Are there any eval firms that allow you to sink to your …
Traders Hideout
NexusFi Journal Challenge - April 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
The Program
18 thanks
GFIs1 1 DAX trade per day journal
18 thanks
  #32 (permalink)
 
Falco11's Avatar
 Falco11 
Vienna,Europe
 
Experience: Advanced
Platform: NT
Broker: NT
Trading: ES,6E
Frequency: Many times daily
Duration: Minutes
Posts: 68 since Dec 2010
Thanks Given: 181
Thanks Received: 64


jigdaddy View Post
Can you send us a link to where you bought the indicator?

TIA!

Hilbert Sine Wave – This Little Know Indicator Transformed My Trading

Reply With Quote
  #33 (permalink)
 sexd 
Hongkong
 
Experience: Beginner
Platform: Ninjatrader
Broker: IB
Trading: Piano
Posts: 2 since Dec 2010




Sir:

I am testing......

any different ?

Attached Thumbnails
Click image for larger version

Name:	new.BMP
Views:	1121
Size:	2.77 MB
ID:	82649   Click image for larger version

Name:	old.BMP
Views:	743
Size:	2.76 MB
ID:	82650  
Reply With Quote
  #34 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704



I think he was asking the gentleman who has the TOS version that allows custom inputs. Barry's version doesn't allow custom inputs (for the S/R calc's or plots).

I'd be interested in seeing the more open version as well.

"A dumb man never learns. A smart man learns from his own failure and success. But a wise man learns from the failure and success of others."
Reply With Quote
  #35 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102

Most of the versions of the Hilbert Sinewave Oscillator, which I have seen are flawed. The formula used by John Ehlers is complex - see his book "Cybernetic Analysis for Stocks and Futures" pp 154,155, and the translation to eSignal by his partner Chris Kryza already uses a different formula. Both formulae have a severe bug, and should not be adopted without modifcation.

I have found three versions for NinjaTrader:


1) Sinewave

Source: NinjaTrader Support Forum - View Single Post - Ehlers Sine Wave

The indicator follows the original TradeStation by John Ehlers as closely as possible. The bug made by John Ehlers is conserved, a second bug - false period for GetMedian - is added. A relatively useless feature has been added to replace the triangular smoothing of the input series used by John Ehlers with other more fancy smoothing methods (Hull, JMA, VWMA, ....). The indicator plots S/R lines based on cyclical tops and bottoms on the price panel. These slow down NinjaTrader a bit. It would make more sense to draw them with a second indicator that uses a real plot, instead of those unhealthy Draw() methods.

Verdict: Do not use it.

2) HilbertSinewaveOscillator:



The indicator uses a different approach to calculate the sinewave. It uses the HilbertTransform2 indicator with a setting of 0.07. The period which can be set via indicator is fake, as it is never used by the calculations. I have not fully understood the formula.

Verdict: The indicator comes close to the original Ehlers formula, the bug is removed.

3) HilbertSW:

Indicator from this thread. Nice indicator, but has nothing or little to do with the Hilbert Sinewave indicator by John Ehlers.


There are various implementations in other software packages, which all differ in various details. The subject is not really easy to discuss. At some stage I had built my own versions of the sinewave indicators. I have not published them, because this would have further contributed to the general confusion.

Actually I would like to discuss the issue with somebody, who has a thorough understanding of the underlying logic of these filters.


Reply With Quote
  #36 (permalink)
jodo
taipei/taiwan
 
Posts: 2 since Apr 2013
Thanks Given: 0
Thanks Received: 0


vegasfoster View Post
found this on nt forum, not sure if it is wut ur looking for

Hi, do you have sine wave indicator for TS or MC?
thank you for your kind help!

Reply With Quote
  #37 (permalink)
 olobay 
Montreal
 
Experience: Intermediate
Platform: MultiCharts
Broker: DeepDiscountTrading.com
Trading: CL
Posts: 364 since Jul 2011


jodo View Post
Hi, do you have sine wave indicator for TS or MC?
thank you for your kind help!

Here you go.

 
Code
{Sine Wave indicator - //// From 'Cybernetic Analysis for Stocks and Futures' by John Ehlers //// code compiled by dn
 } // plot on a subgraph separate from the price region.

Inputs: Price((H+L)/2), alpha(.07); 

Vars: Smooth(0),Cycle(0),I1(0),Q1(0),I2(0),Q2(0),DeltaPhase(0),MedianDelta(0),MaxAmp(0),AmpFix(0),Re(0),Im(0),DC(0),
 alpha1(0),InstPeriod(0),DCPeriod(0),count(0),SmoothCycle(0),RealPart(0),ImagPart(0),DCPhase(0);

Smooth = (Price+2*Price[1]+2*Price[2]+Price[3])/6;
 Cycle = (1-.5*alpha)*(1-.5*alpha)*(Smooth-2*Smooth[1]+Smooth[2])+2*(1-alpha)*Cycle[1]-(1-alpha)*(1-alpha)*Cycle[2];
 If CurrentBar <7 then Cycle=(Price-2*Price[1]+Price[2])/4; 
Q1=(.0962*Cycle+.5769*Cycle[2]-.5769*Cycle[4]-.0962*Cycle[6])*(.5+.08*InstPeriod[1]);
 I1 = Cycle[3];
 If Q1<>0 and Q1[1]<>0 then DeltaPhase=(I1/Q1-I1[1]/Q1[1])/(1+I1*I1[1]/(Q1*Q1[1]));
 If DeltaPhase <0.1 then DeltaPhase=0.1;
 If DeltaPhase > 1.1 then DeltaPhase = 1.1;
 MedianDelta = Median(DeltaPhase,5);
 If MedianDelta =0 then DC=15 else DC=6.28318/MedianDelta+.5;
 InstPeriod=.33*DC+.67*InstPeriod[1];
 Value1 = .15*InstPeriod+.85*Value1[1];
 DCPeriod = IntPortion(Value1); 
RealPart = 0; 
ImagPart = 0; 
For count = 0 To DCPeriod - 1 begin 
RealPart = RealPart + Sine(360 * count / DCPeriod) * (Cycle[count]); 
ImagPart = ImagPart + Cosine(360 * count / DCPeriod) * (Cycle[count]); 
End; 
If AbsValue(ImagPart) > 0.001 then DCPhase = Arctangent(RealPart / ImagPart); 
If AbsValue(ImagPart) <= 0.001 then DCPhase = 90 * Sign(RealPart); 

DCPhase = DCPhase + 90; 
If ImagPart < 0 then DCPhase = DCPhase + 180; 
If DCPhase > 315 then DCPhase = DCPhase - 360; 

Plot1(Sine(DCPhase), "Sine",blue); 
Plot2(Sine(DCPhase + 45), "LeadSine",green); 

{Note: This indicator tries to determine the current phase of the cycles you are in. A sinewave indicator has an advantage over 
other oscillators such as RSI and Stochastic because it predicts rather than waits for confirmation. This assumes that the measured 
phase has existed at least briefly in the past and will continue at least briefly into the future. 
The phase languishes when the market is in a trend mode, and can even have a negative rate of change.
 This indicator gives entry and exit signals 1/16th of a cycle period in advance of the cycle turning point 
and seldom gives false whipsaw signals when the market is in a trend mode.}

Reply With Quote
  #38 (permalink)
jodo
taipei/taiwan
 
Posts: 2 since Apr 2013
Thanks Given: 0
Thanks Received: 0


olobay View Post
Here you go.

 
Code
{Sine Wave indicator - //// From 'Cybernetic Analysis for Stocks and Futures' by John Ehlers //// code compiled by dn
 } // plot on a subgraph separate from the price region.

Inputs: Price((H+L)/2), alpha(.07); 

Vars: Smooth(0),Cycle(0),I1(0),Q1(0),I2(0),Q2(0),DeltaPhase(0),MedianDelta(0),MaxAmp(0),AmpFix(0),Re(0),Im(0),DC(0),
 alpha1(0),InstPeriod(0),DCPeriod(0),count(0),SmoothCycle(0),RealPart(0),ImagPart(0),DCPhase(0);

Smooth = (Price+2*Price[1]+2*Price[2]+Price[3])/6;
 Cycle = (1-.5*alpha)*(1-.5*alpha)*(Smooth-2*Smooth[1]+Smooth[2])+2*(1-alpha)*Cycle[1]-(1-alpha)*(1-alpha)*Cycle[2];
 If CurrentBar <7 then Cycle=(Price-2*Price[1]+Price[2])/4; 
Q1=(.0962*Cycle+.5769*Cycle[2]-.5769*Cycle[4]-.0962*Cycle[6])*(.5+.08*InstPeriod[1]);
 I1 = Cycle[3];
 If Q1<>0 and Q1[1]<>0 then DeltaPhase=(I1/Q1-I1[1]/Q1[1])/(1+I1*I1[1]/(Q1*Q1[1]));
 If DeltaPhase <0.1 then DeltaPhase=0.1;
 If DeltaPhase > 1.1 then DeltaPhase = 1.1;
 MedianDelta = Median(DeltaPhase,5);
 If MedianDelta =0 then DC=15 else DC=6.28318/MedianDelta+.5;
 InstPeriod=.33*DC+.67*InstPeriod[1];
 Value1 = .15*InstPeriod+.85*Value1[1];
 DCPeriod = IntPortion(Value1); 
RealPart = 0; 
ImagPart = 0; 
For count = 0 To DCPeriod - 1 begin 
RealPart = RealPart + Sine(360 * count / DCPeriod) * (Cycle[count]); 
ImagPart = ImagPart + Cosine(360 * count / DCPeriod) * (Cycle[count]); 
End; 
If AbsValue(ImagPart) > 0.001 then DCPhase = Arctangent(RealPart / ImagPart); 
If AbsValue(ImagPart) <= 0.001 then DCPhase = 90 * Sign(RealPart); 

DCPhase = DCPhase + 90; 
If ImagPart < 0 then DCPhase = DCPhase + 180; 
If DCPhase > 315 then DCPhase = DCPhase - 360; 

Plot1(Sine(DCPhase), "Sine",blue); 
Plot2(Sine(DCPhase + 45), "LeadSine",green); 

{Note: This indicator tries to determine the current phase of the cycles you are in. A sinewave indicator has an advantage over 
other oscillators such as RSI and Stochastic because it predicts rather than waits for confirmation. This assumes that the measured 
phase has existed at least briefly in the past and will continue at least briefly into the future. 
The phase languishes when the market is in a trend mode, and can even have a negative rate of change.
 This indicator gives entry and exit signals 1/16th of a cycle period in advance of the cycle turning point 
and seldom gives false whipsaw signals when the market is in a trend mode.}

thank you so much!
However, do you have the advanced version? which may be called "Better Sine Wave" for TS or MC
Many thanks!!

Reply With Quote
  #39 (permalink)
 
noyss's Avatar
 noyss 
Ibiza. Spain
 
Experience: Intermediate
Platform: MT4
Broker: Darwinex
Trading: EminiSP, Crude, Euro/Dolar, Bitcoin.
Posts: 76 since Jul 2012
Thanks Given: 121
Thanks Received: 32


Fat Tails View Post
Most of the versions of the Hilbert Sinewave Oscillator, which I have seen are flawed. The formula used by John Ehlers is complex - see his book "Cybernetic Analysis for Stocks and Futures" pp 154,155, and the translation to eSignal by his partner Chris Kryza already uses a different formula. Both formulae have a severe bug, and should not be adopted without modifcation.

I have found three versions for NinjaTrader:


1) Sinewave

Source: NinjaTrader Support Forum - View Single Post - Ehlers Sine Wave

The indicator follows the original TradeStation by John Ehlers as closely as possible. The bug made by John Ehlers is conserved, a second bug - false period for GetMedian - is added. A relatively useless feature has been added to replace the triangular smoothing of the input series used by John Ehlers with other more fancy smoothing methods (Hull, JMA, VWMA, ....). The indicator plots S/R lines based on cyclical tops and bottoms on the price panel. These slow down NinjaTrader a bit. It would make more sense to draw them with a second indicator that uses a real plot, instead of those unhealthy Draw() methods.

Verdict: Do not use it.

2) HilbertSinewaveOscillator:



The indicator uses a different approach to calculate the sinewave. It uses the HilbertTransform2 indicator with a setting of 0.07. The period which can be set via indicator is fake, as it is never used by the calculations. I have not fully understood the formula.

Verdict: The indicator comes close to the original Ehlers formula, the bug is removed.

3) HilbertSW:

Indicator from this thread. Nice indicator, but has nothing or little to do with the Hilbert Sinewave indicator by John Ehlers.


There are various implementations in other software packages, which all differ in various details. The subject is not really easy to discuss. At some stage I had built my own versions of the sinewave indicators. I have not published them, because this would have further contributed to the general confusion.

Actually I would like to discuss the issue with somebody, who has a thorough understanding of the underlying logic of these filters.



Hi Fat tails,


Did you make any improvements on your Sinewave indicator?



Reply With Quote
Thanked by:
  #40 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102



noyss View Post
Hi Fat tails,


Did you make any improvements on your Sinewave indicator?



I had played around with the various models of the SineWave indicator. However, so far I have not understood, how to use this indicator in an efficient way.

I would like to discuss the matter with somebody, who has an advanced understanding of the Ehlers SineWave indicator. Of course, I am willing to share everything that I have coded.

Reply With Quote
Thanked by:




Last Updated on November 20, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts