Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Ehlers Filter
Collapse
X
-
It didn't plot for me either.
This may be similar though:
Comment
-
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....
Comment
-
Here's a bunch of info (including EasyLanguage code) on the Ehler's filter...
This is the code that was posted before, maybe someone can find the problem.
Code:#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 } }
Last edited by Elliott Wave; 06-11-2008, 08:32 AM.
Comment
-
Here is a chart of Nonlinear Filters Rated. Elhers scored the best overall.
Mathamatical formula's and Easy language script here for light reading.
Comment
-
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.Last edited by Elliott Wave; 06-11-2008, 02:02 PM.
Comment
-
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)??
Comment
-
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.
Comment
-
Originally posted by whitegun View PostHi 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)??
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 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...Last edited by Elliott Wave; 06-14-2008, 01:46 PM.
Comment
-
Originally posted by scjohn View PostFirst 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.
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.Attached Files
Comment
-
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.
RJayLast edited by RJay; 06-20-2008, 03:02 PM.
Comment
-
Originally posted by rt6176 View PostHi 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
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...
Comment
-
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.
RJayAttached Files
Comment
-
Well, at least the error didn't seem to make any difference to the result (at least as far as I can tell)
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,403 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
||
Started by Shai Samuel, 07-02-2022, 02:46 PM
|
4 responses
94 views
0 likes
|
Last Post
by Bidder
Today, 12:11 AM
|
||
Started by DJ888, Yesterday, 10:57 PM
|
0 responses
6 views
0 likes
|
Last Post
by DJ888
Yesterday, 10:57 PM
|
||
Started by MacDad, 02-25-2024, 11:48 PM
|
7 responses
158 views
0 likes
|
Last Post Yesterday, 10:23 PM | ||
Started by Belfortbucks, Yesterday, 09:29 PM
|
0 responses
8 views
0 likes
|
Last Post
by Belfortbucks
Yesterday, 09:29 PM
|
Comment