Announcement

Collapse
No announcement yet.

Hursts' Cycles

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

  • Hursts' Cycles

    I'm studing hurst cycles and thanks to a member of equis forum i've now a script for the sinewaves that hurst wrote in his famous book.

    Can someone tranlsate it in efs?

    thanks.

    here the metastock indicator:

    ************************************************** **

    {coded for and with LG, 2008}
    {copyright 2008, Scott Bunny}

    D:=Input("Day of month",1,31,1);
    M:=Input("Month",1,12,1);
    Y:=Input("Year",1900,2100,2008);

    WA2:=Input("wave2",0,10,3);

    wavelength:=Input("Wavelength (bars)",1,9999,243);

    {bars}
    start:=***(
    (DayOfMonth()>=D AND Month()=M AND Year()=Y) OR
    (Month()>M AND Year()=Y) OR
    Year()>Y)=1;
    start:=LastValue(ValueWhen(1,start,***(1)));

    {x axis values}
    x:=360/wavelength * (***(1)-start);

    {sine waves}
    phase:=-90;
    w1:=Sin(8*x+phase);
    w2:=2*Sin(4*x+phase);
    w3:=wa2*Sin(2*x+phase);
    w4:=4*Sin(x+phase);

    {hurst cycle}

    CYCLE:= (W1+W2+W3+W4);

    {plot}
    w1;w2;w3;w4;CYCLE;

    ************************************************** **

    gigi
    Attached Files

  • #2
    gigi,

    Here is the converted code, now you can use this indicator in eSignal. When you apply it please don't forget to go to the Edit Studies and select No Scale option for this indicator. Hope this helps in your trading!


    PHP Code:
    // EMET

    var fpArray = new Array();
    var 
    bInit false;

    function 
    preMain() {

        
    setPriceStudy(true);
        
    setStudyTitle("Wave");
        
    setCursorLabelName("W1"0);
        
    setCursorLabelName("W2"1);    
        
    setCursorLabelName("W3"2);        
        
    setCursorLabelName("W4"3);        
        
    setCursorLabelName("CYCLE"4);            
        
    setDefaultBarFgColor(Color.lime0);
        
    setDefaultBarFgColor(Color.lime1);    
        
    setDefaultBarFgColor(Color.lime2);    
        
    setDefaultBarFgColor(Color.lime3);    
        
    setDefaultBarFgColor(Color.black4);        
        
    setPlotType(PLOTTYPE_LINE0); 
        
    setPlotType(PLOTTYPE_LINE1);     
        
    setPlotType(PLOTTYPE_LINE2);     
        
    setPlotType(PLOTTYPE_LINE3);         
        
    setPlotType(PLOTTYPE_LINE4);             
        
    setDefaultBarThickness(10);
        
    setDefaultBarThickness(11);
        
    setDefaultBarThickness(12);
        
    setDefaultBarThickness(13);        
        
    setDefaultBarThickness(24);            
       
       
    //Other param
        
    askForInput();

        var 
    x=0;

        
    fpArray[x] = new FunctionParameter("WA2"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(0);
            
    setUpperLimit(10);
            
    setDefault(3);
        }
        
    fpArray[x] = new FunctionParameter("Wavelength"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(1);
            
    setUpperLimit(9999);
            
    setDefault(243);
        }
        
    fpArray[x] = new FunctionParameter("Color_Line1"FunctionParameter.COLOR);
        
    with(fpArray[x++]){
           
    setDefault(Color.lime);
        }    
        
    fpArray[x] = new FunctionParameter("Color_Line2"FunctionParameter.COLOR);
        
    with(fpArray[x++]){
         
    setDefault(Color.lime);    
        }    
        
    fpArray[x] = new FunctionParameter("Color_Line3"FunctionParameter.COLOR);
        
    with(fpArray[x++]){
         
    setDefault(Color.lime);    
        }    
        
    fpArray[x] = new FunctionParameter("Color_Line4"FunctionParameter.COLOR);
        
    with(fpArray[x++]){
          
    setDefault(Color.lime);    
        }    
        
    fpArray[x] = new FunctionParameter("Color_Line5"FunctionParameter.COLOR);
        
    with(fpArray[x++]){
          
    setDefault(Color.black);    
        }    

      
    }

    function 
    main(WA2WavelengthColor_Line1Color_Line2Color_Line3Color_Line4Color_Line5) {
    var 
    0;
    var 
    CYCLEW1W2W3W4;
    var 
    phase = (-90);
    var 
    pi 3.1415926;


    //Initialization
     
    if (bInit == false) {
        
    setDefaultBarFgColor(Color_Line10);
        
    setDefaultBarFgColor(Color_Line21);    
        
    setDefaultBarFgColor(Color_Line32);    
        
    setDefaultBarFgColor(Color_Line43);    
        
    setDefaultBarFgColor(Color_Line54);        
       
    bInit true;
     } 

     
    //{x axis values}
     
    360 Wavelength getCurrentBarCount();

    //{sine waves}
    W1 Math.sin((pi * (phase)) / 180);
    W2 2*Math.sin((pi * (phase)) / 180);
    W3 WA2*Math.sin((pi * (phase)) / 180);
    W4 4*Math.sin((pi * (phase)) / 180);


    //{hurst cycle}
    CYCLE W1 W2 W3 W4;

      
    //{plot}
     
    return new Array (W1W2W3W4CYCLE);

    EMET

    Comment


    • #3
      how come there is nothing come up when I use it...How to turn off scaling...

      Comment


      • #4
        vincentjiang
        You do that in Edit Studies by setting the scale of the study to No Scale as indicated by emet
        Alex


        Originally posted by vincentjiang
        how come there is nothing come up when I use it...How to turn off scaling...

        Comment


        • #5
          Thanks emet.

          But in metastock I can make to start the cycle from the date that I want. Usually a date of a low.

          Do you have some idea on as to implement the code?

          And then,

          it would be fantastic if the cycle was projected in the future.

          Thanks for all.

          gg

          Comment


          • #6
            Theese are the inputs (metastock lang.) to insert in efs to start from a specific date the hurst's cycle.


            *******************

            D:=Input("Day of month",1,31,1);
            M:=Input("Month",1,12,1);
            Y:=Input("Year",1900,2100,2008);


            ********************


            How can i make it?

            thx.

            gg

            Comment


            • #7
              Hi

              Checkout my recent post:

              EFS Studies
              'Draw starting at mouse click'

              Comment


              • #8
                Hi red,

                thanks for the reply but it's too much complex for my knowledges...

                Have you any idea how to set this efs with your discover?


                thanks.

                gg

                Comment

                Working...
                X