Announcement

Collapse
No announcement yet.

Volatility with HH / LL

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

  • Volatility with HH / LL

    Hello

    I would like to see the Volatility (20 days) with a line for the Highiest High and the Lowest Low for 200 bars.

    How can I do that?

    Daniel

  • #2
    it would take someone developing a custom EFS script for you. If you know how to program a little bit - it's not that hard. If not, you could hire one of the custom EFS developers to build it for you.
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Daniel,

      I'm not sure which type of Volatility you prefer to use, I usually work with smoothed ATR. Please see my implementation of your idea below.

      EMET

      PHP Code:
      /Developed by EMET
      //Volatility with a line for the Highiest High and the Lowest Low

      /*
      I would like to see the Volatility (20 days) with a line for the Highiest
      High and the Lowest Low for 200 bars.
      */

      var fpArray = new Array();
      var 
      myVolat null;
      var 
      HHVolat null;
      var 
      LLVolat null;
      var 
      bInit false;

      function 
      preMain() {

          
      setPriceStudy(false);
          
      setStudyTitle("Volatility & HH/LL");
          
      setCursorLabelName("Volatility"0);
          
      setCursorLabelName("Highest"1);
          
      setCursorLabelName("Lowest"2);    
          
      setDefaultBarFgColor(Color.green0);
          
      setDefaultBarFgColor(Color.blue1);    
          
      setDefaultBarFgColor(Color.red2);        
          
      setPlotType(PLOTTYPE_LINE0); 
          
      setPlotType(PLOTTYPE_LINE1);     
          
      setPlotType(PLOTTYPE_LINE2);     
          
      setDefaultBarThickness(10);
          
      setDefaultBarThickness(11);
          
      setDefaultBarThickness(12);
          
          
      askForInput();

          var 
      x=0;
          
      fpArray[x] = new FunctionParameter("Length_Volatility"FunctionParameter.NUMBER);
          
      with(fpArray[x++]){
              
      setLowerLimit(1);        
              
      setDefault(20);
          }
          
      fpArray[x] = new FunctionParameter("Length_HH_LL"FunctionParameter.NUMBER);
          
      with(fpArray[x++]){
              
      setLowerLimit(1);        
              
      setDefault(200);
          }
          
          
      fpArray[x] = new FunctionParameter("Show_HH_LL"FunctionParameter.BOOLEAN);
          
      with(fpArray[x++]){
              
      setDefault(true);
          }    
        
      }

      function 
      main(Length_VolatilityLength_HH_LLShow_HH_LL) {
       var 
      nmyVolat;
       var 
      nHHVolat;
       var 
      nLLVolat;

       if (
      bInit == false) {
         
      myVolat efsInternal("Volatility"Length_Volatility);
         if (
      Show_HH_LL == true) {
           
      HHVolat upperDonchian(Length_HH_LLmyVolat);  
           
      LLVolat lowerDonchian(Length_HH_LLmyVolat);
         }
        
      bInit true;
       } 

        
      nmyVolat myVolat.getValue(0);
         if (
      Show_HH_LL == true) {
           
      nHHVolat HHVolat.getValue(0);
           
      nLLVolat LLVolat.getValue(0);
         } 

         if (
      Show_HH_LL == true) {
           
      setStudyTitle("Volatility & HH/LL");
           return new Array (
      nmyVolatnHHVolatnLLVolat);
         } else {
           
      setStudyTitle("Volatility");
           return 
      nmyVolat;
         }
      }


      function 
      TrueHigh(close1high_) {
        if (
      close1 high_) {
          return 
      close1;
        } else return 
      high_
      }

      function 
      TrueLow(close1,low_) {
        if (
      close1 low_) {
          return 
      close1;
        } else return 
      low_
      }


      function 
      TrueRange() {
        return (
      TrueHigh(close(-1), high(0)) - TrueLow(close(-1), low(0))); 
      }


      function 
      Volatility(Length){
        var 
      SmoothingFactor 1/Length;
        var 
      Price TrueRange();

        if (
      Price == null) return;
        if (
      ref(-1) == null) return Price;

        return 
      ref(-1) + SmoothingFactor * (Price ref(-1));
       

      Comment

      Working...
      X