PDA

View Full Version : Ehlers Filter


scjohn
06-08-2008, 12:03 PM
Thread deleted.

whitegun
06-09-2008, 08:28 PM
Hello scjohn,

which NT did you used to export the indicator?

Because I installed it yesterday but it doues not plot.

Elliott Wave
06-10-2008, 11:15 PM
It didn't plot for me either.

This may be similar though:

http://www.ninjatrader-support.com/vb/local_links.php?catid=1&sort=d

RJay
06-11-2008, 08:17 AM
I was just looking at an Ehlers Filter on another web site last week.

Its on my list of things to do once I learn C# well enough.

Can one of you guys repost the file. I'd like to look at it.

Thanks....

Elliott Wave
06-11-2008, 08:28 AM
Here's a bunch of info (including EasyLanguage code) on the Ehler's filter...

http://shup.com/Shup/45219/Ehlers-Filters.doc


This is the code that was posted before, maybe someone can find the problem.

#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Ehlers Filter by John Elher
/// </summary>
[Description("Ehlers Filter. It is recommend that you use the Price Type of Median.")]
public class EhlersFilter : Indicator
{
#region Variables
// Wizard generated variables
private int length = 20; // Default setting for Length
// User defined variables (add any user defined variables below)
private DataSeries Smooth;
private DataSeries Coef; //defined as an array in EL code
private DataSeries Distance2; //defined as an array in EL code
private int count; //loop index
private int lookback; //loop index
private double Num = 0.00;
private double SumCoef = 0.00;
#endregion

/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.PaleTurquoise ), PlotStyle.Line, "EF"));
CalculateOnBarClose = true;
Overlay = true;
PriceTypeSupported = true; // one should select Median.
Smooth = new DataSeries(this);
Coef = new DataSeries(this);
Distance2 = new DataSeries(this);
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
//
Smooth.Set( (Input[0] + 2*Input[1] + 2*Input[2] + Input[3]) / 6.0);
for ( count = 0; count <= length -1; count++)
{
Distance2.Set( 0.00);
for ( lookback = 1; lookback <= length -1; lookback++)
{
Distance2.Set( Distance2[count] + (Smooth[count] - Smooth[count + lookback])*(Smooth[count] - Smooth[count + lookback]) );
}
Coef.Set( count, Distance2[count] );
}
Num = 0.0;
SumCoef = 0.0;
for ( count = 0; count <= length -1; count++)
{
Num = Num + Coef[count]*Smooth[count];
SumCoef = SumCoef + Coef[count];
}
if( SumCoef != 0) EF.Set( Num / SumCoef );
}

#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries EF
{
get { return Values[0]; }
}

[Description("Length")]
[Category("Parameters")]
public int Length
{
get { return length; }
set { length = Math.Max(1, value); }
}
#endregion
}
}

RJay
06-11-2008, 09:09 AM
Here is a chart of Nonlinear Filters Rated. Elhers scored the best overall.

Mathamatical formula's and Easy language script here for light reading.

http://www.mesasoftware.com/technicalpapers.htm

Elliott Wave
06-11-2008, 10:16 AM
Thats an interesting chart. I'm curious as to how it compares to the JMA. Anyway I played around with the code a little bit, because I noticed it was missing the "if (CurrentBar == 0)..." but I still couldn't get it to plot. Maybe someone else will have better luck.

whitegun
06-14-2008, 12:34 AM
Hi Elliott Wave,

You shoulden't try to compare the filter to JMA because JMA by himselfe is bad as a filter compared to others.
I purchased last month the JMA pagage for NT from Juriks because I could nowhere found a good comparison to comon free filters and compared it to other filters like HMA, LinReg, T3. Of course, each of them has his + and - but overall I found it is inferior to any of the above free filters, at least for forex (EURUSD) what I trade, so I trough avey the money for nothing.
Apart the code of the JMA for NT must be horribly written because it consumes a lot of memory and If you try to load it on a lot of data it will need a eternity or even crush NT so you also can not run backtests on a lot of data.
I also compared the other Jurik tools to the free options, like the Jurik CCI to the standart CCI en NT and there is absolutely no differance none at all, maybe they only change the name but its a standart CCI.
Stay avay from them, thats way they do not let you test their indicators and also have a no refund policy.

P.S. Did you achived to make the ehler filter work (I realy would like to have a look on it)??

scjohn
06-14-2008, 12:18 PM
First off let me apologize for for posting something that I thought was working and it was not. The code that was posted did not plot anything because of "index out of range" error in the log file.

I think that this is the line of code that is causing the problem:
Distance2.Set( Distance2[count] + (Smooth[count] - Smooth[count + lookback])*(Smooth[count] - Smooth[count + lookback]) );

It's the + lookback that I think is causing the problem. Since Smooth is a DataSeries that is build on the fly (bar by bar) you will always end up with an index that will be outside the current size/count of the collection (DataSeries Smooth).

That's the way I see it. It would seem the EL does thing differently.

Also, Coef and Distance2 might need to changed to arrays as opposed to DataSeries. Not sure if one can substitute a DataSeries for an array.

Elliott Wave
06-14-2008, 01:29 PM
Hi Elliott Wave,

You shoulden't try to compare the filter to JMA because JMA by himselfe is bad as a filter compared to others.
I purchased last month the JMA pagage for NT from Juriks because I could nowhere found a good comparison to comon free filters and compared it to other filters like HMA, LinReg, T3. Of course, each of them has his + and - but overall I found it is inferior to any of the above free filters, at least for forex (EURUSD) what I trade, so I trough avey the money for nothing.
Apart the code of the JMA for NT must be horribly written because it consumes a lot of memory and If you try to load it on a lot of data it will need a eternity or even crush NT so you also can not run backtests on a lot of data.
I also compared the other Jurik tools to the free options, like the Jurik CCI to the standart CCI en NT and there is absolutely no differance none at all, maybe they only change the name but its a standart CCI.
Stay avay from them, thats way they do not let you test their indicators and also have a no refund policy.

P.S. Did you achived to make the ehler filter work (I realy would like to have a look on it)??

Interesting. I actually got the Jurik package myself yesterday, and while its a little too soon to make any judgements, so far I'm quite impressed ( I also trade EURUSD). I agree that T3 can get you 95% of the way there, but I'm happy to pay for the 5% advantage. In terms of using the JMA to presmooth an indicator, I was able to replicate the results VERY close with T3 (different smooth period though). Where I think the JMA has an advantage over the T3 is in price gaps (not as applicable in Forex) and big price spikes. It tends to track the changes quicker, whereas T3 is a bit slower and will overshoot. I think the usefulness depends entirely on your application, and for me I'm pretty sure over the next 6 months they will pay for themselves.

Another point I agree with is that some of the NinjaScript indicators could be programmed a bit better, for example the JurikRSX has no center, or overbought/oversold lines etc. the same with many other indicators. I'll likely change this myself and will be glad to share the results with other NT Jurik users.

As both the T3 and JMA were introduced in 1998, I find it hard to believe that nothing better has come out since (at least that I can find). To be honest I'm pretty sure there are many better moving averages, but no one is making them public :)

And no, I wasn't able to get the filter working. My understanding of C# is limited and anything I do is usually other stuff hacked together :p I really hope it gets figured out though, it may just be the JMA killer I've been looking for...


P.S. I found this post on another board that had me intrigued.

BTW, are folk paying good money for this JMA thingy? Looks to me like a simple raised-cosine-windowed root-nyquist filter with the coeffs tweaked by the trusty old Remez Exchange algorithm. Should take around 10 minutes on MatLab to knock up something equivalent or better...

Elliott Wave
06-14-2008, 01:37 PM
First off let me apologize for for posting something that I thought was working and it was not. The code that was posted did not plot anything because of "index out of range" error in the log file.

I think that this is the line of code that is causing the problem:
Distance2.Set( Distance2[count] + (Smooth[count] - Smooth[count + lookback])*(Smooth[count] - Smooth[count + lookback]) );

It's the + lookback that I think is causing the problem. Since Smooth is a DataSeries that is build on the fly (bar by bar) you will always end up with an index that will be outside the current size/count of the collection (DataSeries Smooth).

That's the way I see it. It would seem the EL does thing differently.

Also, Coef and Distance2 might need to changed to arrays as opposed to DataSeries. Not sure if one can substitute a DataSeries for an array.

No need to apologize for posting something that didn't work, the worst think you did was delete it! ;)

Since I know you removed it because it wasn't working and not for other reasons, I'll repost the NS file and maybe with the insights you've just provided, one the the resident C# wizards may get bored and play around with it. :rolleyes:

RJay
06-15-2008, 02:47 PM
Hi Guys ,

I spent several hours this weekend working on this indicator.

I believe I've got it working. Beginners luck for sure.

I could never have built this code from scratch.

There were a couple minor problems with the conversion to NT and the code grouping. Otherwise it was nearly perfect.

Give it a go and let me know.

RJay :):):)

Elliott Wave
06-15-2008, 03:01 PM
Hi Guys ,

I spent several hours this weekend working on this indicator.

I believe I've got it working. Beginners luck for sure.

I could never have built this code from scratch.

There were a couple minor problems with the conversion to NT and the code grouping. Otherwise it was nearly perfect.

Give it a go and let me know.

RJay

You're awesome! :D It works for me. Thank you.

To answer my own question, here is a quick and dirty comparison between the Ehler's filter and the JurikJMA.

As you can see the Ehler's filter hold's up nicely...

http://shup.com/Shup/45940/Ehlers-vs-JMA.jpg

RJay
06-20-2008, 03:16 PM
Well, The good news is that I'm smarter now than I was last week with this stuff.

The bad news is I found an error in one of the loops for this indicator.

Attached here is the updated zip file with the fix.

I also set input default to Median as prescribed by John Elhers.

The old zip file has been deleted.

RJay :o:o:o

Elliott Wave
06-20-2008, 06:55 PM
Well, at least the error didn't seem to make any difference to the result (at least as far as I can tell) :)

RJay
06-23-2008, 09:15 AM
I didn't notice any difference either, Thank The Maker!!! ;)

Riverend
02-27-2009, 12:40 PM
Interesting. I actually got the Jurik package myself yesterday, and while its a little too soon to make any judgements, so far I'm quite impressed ( I also trade EURUSD). I agree that T3 can get you 95% of the way there, but I'm happy to pay for the 5% advantage. In terms of using the JMA to presmooth an indicator, I was able to replicate the results VERY close with T3 (different smooth period though). Where I think the JMA has an advantage over the T3 is in price gaps (not as applicable in Forex) and big price spikes. It tends to track the changes quicker, whereas T3 is a bit slower and will overshoot. I think the usefulness depends entirely on your application, and for me I'm pretty sure over the next 6 months they will pay for themselves.

Another point I agree with is that some of the NinjaScript indicators could be programmed a bit better, for example the JurikRSX has no center, or overbought/oversold lines etc. the same with many other indicators. I'll likely change this myself and will be glad to share the results with other NT Jurik users.

As both the T3 and JMA were introduced in 1998, I find it hard to believe that nothing better has come out since (at least that I can find). To be honest I'm pretty sure there are many better moving averages, but no one is making them public :)

And no, I wasn't able to get the filter working. My understanding of C# is limited and anything I do is usually other stuff hacked together :p I really hope it gets figured out though, it may just be the JMA killer I've been looking for...


P.S. I found this post on another board that had me intrigued.
Elliott Wave and Whitegun,
Thanks for your thought on Jurik indicators. I searched the forums and found very little tlak about them. Elliot are you still finding them useful ? Would appreciate anyone elses thoughts about the Jurik indicators.

Elliott Wave
02-28-2009, 04:10 AM
Elliott Wave and Whitegun,
Thanks for your thought on Jurik indicators. I searched the forums and found very little tlak about them. Elliot are you still finding them useful ? Would appreciate anyone elses thoughts about the Jurik indicators.

Yes they are still useful. Probably the most useful and best value in the third party category for NT (imo).

I'm currently holding off on any more NT system/indicator development until NT7 beta comes out but once indicator on indicator is as easy as it should be, I think the Jurik indicators will be even more useful.

Riverend
02-28-2009, 09:46 AM
Thanks for your input EW. I thinks it worth looking at.