Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ehlers Filter

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Ehlers Filter

    Thread deleted.
    Last edited by scjohn; 06-09-2008, 12:22 PM.

    #2
    Hello scjohn,

    which NT did you used to export the indicator?

    Because I installed it yesterday but it doues not plot.

    Comment


      #3
      It didn't plot for me either.

      This may be similar though:

      Comment


        #4
        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....
        RJay
        NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

        Comment


          #5
          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


            #6
            Here is a chart of Nonlinear Filters Rated. Elhers scored the best overall.

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

            Attached Files
            RJay
            NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

            Comment


              #7
              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


                #8
                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


                  #9
                  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


                    #10
                    Originally posted by whitegun View Post
                    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 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


                      #11
                      Originally posted by scjohn View Post
                      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.
                      Attached Files

                      Comment


                        #12
                        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
                        Last edited by RJay; 06-20-2008, 03:02 PM.
                        RJay
                        NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

                        Comment


                          #13
                          Originally posted by rt6176 View Post
                          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! 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...

                          Comment


                            #14
                            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
                            Attached Files
                            RJay
                            NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

                            Comment


                              #15
                              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 aa731, Today, 02:54 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post aa731
                              by aa731
                               
                              Started by thanajo, 05-04-2021, 02:11 AM
                              3 responses
                              469 views
                              0 likes
                              Last Post tradingnasdaqprueba  
                              Started by Christopher_R, Today, 12:29 AM
                              0 responses
                              10 views
                              0 likes
                              Last Post Christopher_R  
                              Started by sidlercom80, 10-28-2023, 08:49 AM
                              166 responses
                              2,237 views
                              0 likes
                              Last Post sidlercom80  
                              Started by thread, Yesterday, 11:58 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post thread
                              by thread
                               
                              Working...
                              X