Announcement

Collapse
No announcement yet.

Ultimate Oscillator

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

  • Ultimate Oscillator

    How does the Ultimate Oscillator work? What are its components?

  • #2
    Camyug,

    You may want to take a look at the following post. This is the code used to construct the Ultimate Oscillator. You may also want to look at the following site for additional information regarding how to use this study. Hope this helps.

    Comment


    • #3
      DuaneG

      Many Thanks.

      Comment


      • #4
        DuaneG

        For some reason the forst link in your post does not work.

        A page is loaded that states I don't have permission...

        I would like to get the U Osc.

        Thanks

        Comment


        • #5
          Hmmm,

          I pulled it up ok, but regardless, here is the code for the Ultimate Oscillator from that post.



          PHP Code:
          function preMain(){
              
          setStudyTitle("Ultimate Oscillator");
              
          setCursorLabelName("UO");
              
          addBand(70,PS_SOLID,1,Color.red);
              
          addBand(50,PS_SOLID,1,Color.yellow);
              
          addBand(30,PS_SOLID,1,Color.green);
          }

          function 
          main(Period_short,Period_med,Period_long){
              if(
          Period_short == null || Period_med == null || Period_long == null){
                  
          Period_short 7;
                  
          Period_med 14;
                  
          Period_long 28;
              }

              var 
          vMaxPeriod Math.max(Math.max(Period_shortPeriod_med), Period_long);

              
          /*TR (True Range is the higher of 
              1.) Today's High - Today's Low; 
              2.) Today's High - Yesterday's Close; 
              3.) Yesterday's Close - Today's Low.*/
              
              
          var TRTLBP

              
          var TH_TL 0;
              var 
          TH_YC 0;
              var 
          YC_TL 0;

              var 
          vLows low(0, -(vMaxPeriod+1));
              var 
          vCloses close(0, -(vMaxPeriod+1));
              var 
          vHighs high(0, -(vMaxPeriod+1));
              
              var 
          sumBP_short 0;
              var 
          sumBP_med 0;
              var 
          sumBP_long 0;
              var 
          sumTR_short 0;
              var 
          sumTR_med 0;
              var 
          sumTR_long 0;
              
              for(
          i=0;i<vMaxPeriod;i++){
                  
          TL Math.min(vLows[i], vCloses[i+1]);
                  
          BP vCloses[i] - TL;
                  
                  
          TH_TL vHighs[i] - vLows[i]; 
                  
          TH_YC vHighs[i] - vCloses[i+1]; 
                  
          YC_TL vCloses[i+1] - vLows[i]; 
                  
                  
          TR Math.max(TH_TL,TH_YC);
                  
          TR Math.max(TR,YC_TL);
                  
                  if(
          Period_short) {
                      
          sumBP_short +=BP;
                      
          sumTR_short +=TR;
                  }
                  
                  if(
          Period_med) {
                      
          sumBP_med +=BP;
                      
          sumTR_med +=TR;
                  }
                  
                  if(
          Period_long) {
                      
          sumBP_long +=BP;
                      
          sumTR_long +=TR;
                  }
                  
                  
              }
             
              var 
          RUO 4*(sumBP_short/sumTR_short) + 2*(sumBP_med/sumTR_med) + (sumBP_long/sumTR_long);
              
              return (
          RUO/(4+2+1))*100;

          Comment


          • #6
            Thank you that was fast.

            Comment


            • #7
              We aim to please

              Comment

              Working...
              X