Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Elliptic Oscillator.

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

    Elliptic Oscillator.

    Hey Everyone,

    There is an Elliptic Filter posted in the download section. In the accompanying documents there is an explanation of the filter. The author(Ehlers) talks of an oscillator. I'll provide the code he gives but beyond that, I don't know what to do to get the two lines he uses.

    Smooth = .13785*Price + .0007*Price[1] + .13785*Price[2] + 1.2103*Smooth[1] - .4867*Smooth[2];

    Inputs: Price((H+L)/2);


    Vars: Detrend(0);


    Value1 = Price + .088*Value1[6];
    Value2 = Value1 – Value1[6] + 1.2*Value2[6] - .7*Value2[12];
    Detrend = Value2[12] – 2*Value2[6] + Value2;


    Plot1(Detrend, “Detrend”);


    Smooth = .13785*(2*Price – Price[1]) + .0007*(2*Price[1] – Price[2]) + .13785*(2*Price[2] –Price[3]) + 1.2103*Smooth[1] - .4867*Smooth[2]


    The first is the Elliptic filter. The second is the Detrend formula and the third is the Modified Elliptic filter.

    #2
    May be the community wanted to provide some support to convert this indicator to NinjaScript...

    Comment


      #3
      I converted the MEF, if that is what you are referring to. If you have a link with more info on the oscillator I'll check it out and see if it can easily be converted as well.

      Comment


        #4
        Response.

        Hey EW,

        Here you go. It's the link to where I got everything.



        Originally posted by Elliott Wave View Post
        I converted the MEF, if that is what you are referring to. If you have a link with more info on the oscillator I'll check it out and see if it can easily be converted as well.

        Comment


          #5
          Detrending Oscillator

          Hi,
          I am wondering if anyone has written an indicator based on the formulas in the article by John Ehlers ?
          It looks promising in the article.

          Comment


            #6
            All indicators available are generally located in the File Sharing section of the forums. Please try searching there.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              I Looked there but did not find anything that matches the code in this thread.
              I made an attemp at coding this...the results are not quite what I expected.
              I am copying the main code to see if anyone has any ideas.

              protected override void Initialize()
              {
              Add(new Plot(Color.Green, "Detrend"));
              Add(new Plot(Color.Orange, "Avg"));

              Add(new Line(Color.LightGray, 0, "Zero"));
              Add(new Line(Color.YellowGreen, 80, "Upper"));

              Value1 = new DataSeries(this);
              Value2 = new DataSeries(this);
              }

              /// <summary>
              /// Calculates the indicator value(s) at the current index.
              /// </summary>
              protected override void OnBarUpdate()
              {
              Print("Time"+ Time[0]);
              Print("CurrentBar="+ CurrentBar);
              if( CurrentBar < 7)
              {
              /*for (int i=1; i<7;i++)
              Value1.Set(Median[0] + 0.88*Median[i]);
              //Print("i="+ i);
              */
              Value1.Set(Median[0] + 0.88*Median[CurrentBar]);
              Print("Value1="+ Value1[0]);
              }
              else if(CurrentBar < 13)
              {
              //for(int i = 6; i < 13 ; i++)
              {
              Value1.Set(Median[0] + 0.88*Value1[6]);
              Value2.Set(Value1[0] - Value1[6] + 1.2*Value2[6] - .7*Value1[CurrentBar]);
              //Print("i="+ i);
              Print("VAlue1[0]="+Value1[0]);
              Print("Value2[0]="+Value2[0]);
              }
              }
              else if (CurrentBar > 13)
              {
              Value1.Set(Median[0] + 0.88* Value1[6]);
              Value2.Set(Value1[0] - Value1[6] + 1.2*Value2[6]-0.7*Value2[12]);
              Detrend.Set(Value2[12] - 2*Value1[6] + Value2[0]);
              Avg.Set(ModifiedOptimumEllipticFilter(Detrend)[0]);
              }

              }

              #region Properties
              /// <summary>
              /// Gets the Detrend value.
              /// </summary>
              [Browsable(false)]
              [XmlIgnore()]
              public DataSeries Detrend
              {
              get { return Values[0]; }
              }

              /// <summary>
              /// Gets the Avg value.
              /// </summary>
              [Browsable(false)]
              [XmlIgnore()]
              public DataSeries Avg
              {
              get { return Values[1]; }
              }

              /// <summary>
              /// </summary>

              #endregion
              }
              }

              Comment


                #8
                Thanks for posting your code, where do you run into issues with this?

                Comment


                  #9
                  It Complies fine and does plot an oscillator. However the oscillator seems to not really follow the price movement and runs in the 145K to 150k range rather than oscillating around the 0 line. It may be something I missed in the formula,,,

                  Comment


                    #10
                    clfield,

                    Since it is plotting you have it set up properly. You just need to slowly debug your code to figure out the values now. Please take a look at this tip for debugging: http://www.ninjatrader-support2.com/...ead.php?t=3418
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Upon briefly checking the code, I think there's a small error in this line -

                      Value2.Set(Value1[0] - Value1[6] + 1.2*Value2[6] - .7*Value1[CurrentBar]);

                      should be

                      Value2.Set(Value1[0] - Value1[6] + 1.2*Value2[6] - .7*Value2[CurrentBar]);

                      Maybe this helps.

                      Comment


                        #12
                        Thanks for Checking the code. I beleive the line you are referring to is contained in the part of the code where i am trying to get the indicator "Started". The formula refers back to previous values of the value being calculated. I figured that I would need to fill those previous cells in the array with something and figure this the best way to do that. I am referring to the first 2 if CurrentBar statements.
                        MAybe someone has a suggestion for a better way to do this "start up" proccess.

                        Comment


                          #13
                          clfield,

                          I cannot comment on your formulas. You will just need to step through it and figure out how you want to do it.

                          Instead of doing if (CurrentBar < 7) and then doing a loop just do if (CurrentBar == 7) so you only process the loop once. Unfortunately we just do not have the bandwidth to further evaluate your code to see if that will change your calculations.
                          Josh P.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          599 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          344 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          103 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          558 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          557 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X