Announcement

Collapse
No announcement yet.

McClellan Oscillator

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

  • McClellan Oscillator

    I am wondering whether McClellan Oscillator has been implemented and shared somewhere on this web site? If so, I don't need to rewrite the efs by myself. Thanks in advance.


    clearpicks

  • #2
    It`s HERE:

    McClellan Oscillator:
    -------------------------------------------------------------------------
    Function preMain() {
    setStudyTitle("McClellan Oscillator");
    addBand(0, PS_SOLID, 1, Color.lightgrey);
    }
    function main() {
    var v = getValue("Open", 0, -39,"$ADD");
    var sum = 0, s = 0, i = 0;
    for(i = 0; i < 39; i++){
    sum += v[i];
    if(i < 19)
    s += v[i];
    }
    return s / 19 - sum / 39
    }


    McClellan Summation index
    -------------------------------------------------------------------------
    Function preMain() {
    //setPriceStudy(true);
    setStudyTitle("Summation index");
    addBand(0, PS_SOLID, 1, Color.lightgrey);

    }
    var sumi = 0;
    function main() {
    var v = getValue("Open", 0, -39,"$ADD");
    var sum = 0, s = 0, i = 0;
    for(i = 0; i < 39; i++){
    sum += v[i];
    if(i < 19)
    s += v[i];
    }
    sumi += s / 19 - sum / 39;
    return sumi;
    }

    Comment


    • #3
      Re: McClellan Oscillator

      I have tried unsucessfully several times to use these formulas but cannot because of syntax problems in line 1 .Could you please take another look at these formulas

      Comment


      • #4
        colours
        Function preMain() should be function preMain()
        Alex

        Comment


        • #5
          How can the two formulas bellow be modified to use the Exponential Moving Average instead of the simple?

          The McClellan oscillator and the McClellan Summation index are based on the Exponential Moving Average.

          Comment


          • #6
            Hello jm11,

            The following formula should do everything you need. It has the option to have the moving average calculated as simple or exponential and also has the option to turn the summation on or off through the "Edit Studies" option.

            McClellanOsc2.efs

            Jason K.
            Project Manager
            eSignal - an Interactive Data company

            EFS KnowledgeBase
            JavaScript for EFS Video Series
            EFS Beginner Tutorial Series
            EFS Glossary
            Custom EFS Development Policy

            New User Orientation

            Comment


            • #7
              Thank you Jason.
              It works great.

              JM

              Comment


              • #8
                Looks good, but why the apparent difference between the formula and other McClellan charts?

                http://www.decisionpoint.com/affiliate/McOsiRA.html or
                Stockchart.com 's $NYMO

                And is it possible to put long/short signals? TIA.
                Last edited by JT47319; 10-25-2003, 12:14 AM.

                Comment


                • #9
                  JT47319
                  Other than the fact that the y-axis values are different in the Decision Point chart (they do note Ratio Adjusted on the Oscillator and Summation Index) the plots appear to be identical both in shape and in proportions.
                  I also traced some vertical lines at the turning points and they also seem to match.
                  Make sure you have the Exponential turned on because by default it is off.
                  Alex



                  Comment


                  • #10
                    Very cool.

                    Is it possible to do the entire histogram thing with drop down lines and positive green slope and negative red slope?

                    Comment


                    • #11
                      JT47319
                      The attached modified efs should do what you asked. In the sample image below the original Summation Index is shown together with the revised plot
                      The lines and/or sections of code added by me are all commented.
                      Alex

                      Edit after post: See above in this thread for a revised version of the McClellan Oscillator

                      Last edited by ACM; 10-25-2003, 03:17 PM.

                      Comment


                      • #12
                        McClellan OSC2

                        Mr. Montenegro:
                        Do you think you could add an option to add a Moving Average or an Expontial MA to your McClellan OSC2 formula?
                        Also, can you have the option to make the OSC line thicker for us blind folks? Thanks for your help......Greg

                        Comment


                        • #13
                          Greg
                          To make the oscillator lines thicker add the following statement in preMain
                          setDefaultBarThickness(2)
                          Increase the value 2 if necessary
                          Alex

                          Comment


                          • #14
                            Hi Alex.

                            did you ever try this on a live chart? When I do and put it in the SI mode, it loads correctly. Then after a short time the current data point of the line shoots way up, or down, depending I guess on whether the new point is plus or minus.

                            Anyway, just wondered, maybe I have something screwed up.

                            By the way, why did you choose to use the open instead of the close?

                            thanks

                            bigtee

                            Comment


                            • #15
                              bigtee
                              With regards to using the Open you may want to redirect the question to the person who wrote the efs. All I did was add the logic to paint the histogram.
                              Alex

                              Comment

                              Working...
                              X