Announcement

Collapse
No announcement yet.

EFS code for GET Studies

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

  • EFS code for GET Studies

    Thought I would post some sample code that denotes when a Type I or Type II trade happens based on the GET rules. This particular example uses a 6/4 moving average but could be modified for other variations.

    This monitors for a few things a W2, W4, W5, or C. Then whe prices goes through the upside or downside MA, it will (in realtime) fill the study pane with red or green.

    At the close of each bar, depending on the wave, if price closed above or below the MA, it will draw a text label denoting that price closed above or below the MA and at what price.

    Screenshot




    PHP Code:

    var vLen 6// MA length
    var vOff 4// MA Offset

    function preMain() {
        
    setStudyTitle(vLen "/" vOff);
    }

    var 
    elliott = new GetElliottStudy(3000505350);
    var 
    maH = new MAStudy(vLenvOff"High"MAStudy.SIMPLE);
    var 
    maL = new MAStudy(vLenvOff"Low"MAStudy.SIMPLE);

    var 
    nLastWave null;
    var 
    bInTrade false;

    function 
    PrintClose() {
       var 
    close(-1);
       
    *= 100;
       
    Math.floor(x);
       
    /= 100;
       
       return 
    x;
    }

    function 
    main() {
        var 
    vC close();
            var 
    vH maH.getValue(MAStudy.MA);
            var 
    vL maL.getValue(MAStudy.MA);
        var 
    vPrevC close(-1);
            var 
    vPrevH maH.getValue(MAStudy.MA, -1);
            var 
    vPrevL maL.getValue(MAStudy.MA, -1);
        var 
    nWave elliott.getValue(GetElliottStudy.WAVE);



        var 
    nState 0;
        var 
    nBarState getBarState();
        if(
    nBarState == BARSTATE_NEWBAR) {
            if(
    nLastWave != null) {
                if(
    nLastWave == || nLastWave == || nLastWave == || nLastWave == -5
                    
    nState 1// long
                
    else if(nLastWave == -|| nLastWave == -|| nLastWave == -|| nLastWave == 5
                    
    nState = -1// short
            
    }
        }


        if(
    nWave != null)
            
    nLastWave nWave;

        if(
    nLastWave == null || vC == null || vH == null || vL == null)
            return;

        var 
    bColorOK false;

        if(
    nLastWave == || nLastWave == -2)
            
    bColorOK true;
        else if(
    nLastWave == || nLastWave == -5)
            
    bColorOK true;
        else if(
    nLastWave == || nLastWave == -4)
            
    bColorOK true;
        else if(
    nLastWave == || nLastWave == -9)
            
    bColorOK true;



        if(
    bColorOK == true) {
            if(
    vC vH) {
                
    // drawShapeRelative(0, 20, Shape.UPTRIANGLE, "", Color.blue, Shape.RELATIVETOBOTTOM, "Shp" + getValue("rawtime"));
            
    setBarBgColor(Color.lime);
            } else if(
    vC vL) {
                
    // drawShapeRelative(0, 20, Shape.DOWNTRIANGLE, "", Color.red, Shape.RELATIVETOBOTTOM, "Shp" + getValue("rawtime"));
            
    setBarBgColor(Color.red);
            }            
        }

        if(
    nState != 0) {
            if(
    nState == 1) {
                if(!
    bInTrade) {
                    if(
    vPrevC vPrevH) {
                        
    bInTrade true;
                        
    drawTextRelative(-15PrintClose(), Color.whiteColor.blue,
                            
    Text.ONTOP Text.RELATIVETOBOTTOMnull12
                            
    "L" getValue("rawtime"));
                        
                    }
                } else {
                    if(
    vPrevC vPrevL) {
                        
    bInTrade false;
                    }
                }

            } else if(
    nState == -1) {
                if(!
    bInTrade) {
                    if(
    vPrevC vPrevL) {
                        
    bInTrade true;
                        
    drawTextRelative(-15PrintClose(), Color.redColor.black,
                            
    Text.ONTOP Text.RELATIVETOBOTTOMnull12
                            
    "S" getValue("rawtime"));
                    }
                } else {
                    if(
    vPrevC vPrevH) {
                        
    bInTrade false;
                    }
                }

            }
            
        } else {
            
    bInTrade false;
        }


        return;
        

    Matt Gundersen

  • #2
    Here's one more code snippet. See the blue and red triangles at the bottom of the price pane in the image below. Based on this EFS, they denote where pivot points occur.

    You need eSignal 7.2 for this to work.

    PHP Code:
    var = new GetPivotsStudy();

    function 
    preMain() {
        
    setPriceStudy(true);
    }

    function 
    main() {
        var 
    vRet x.getValue(GetPivotsStudy.PIVOTS);

        
        if(
    vRet != null) {

            
    // 1 is primary
            // 2 is major
            // 3 is intermediate
            // 4 is minor.
            // Negative means a lower 
            // Postivie means an upper.
            /****
            if(vRet == 1) {
                drawTextRelative(0, 10, " Pu ", Color.white, Color.blue, 
                    Text.RELATIVETOBOTTOM | Text.BOLD, "Courier", 10, 
                    "P" + getValue("rawtime")());
            } else if(vRet == -1) {
                drawTextRelative(0, 10, " Pd ", Color.black, Color.red, 
                    Text.RELATIVETOBOTTOM | Text.BOLD, "Courier", 10, 
                    "P" + getValue("rawtime")());
            } else if(vRet == 2) {
                drawTextRelative(0, 10, " Mu ", Color.white, Color.blue, 
                    Text.RELATIVETOBOTTOM | Text.BOLD, "Courier", 10, 
                    "M" + getValue("rawtime")());
            } else if(vRet == -2) {
                drawTextRelative(0, 10, " Md ", Color.black, Color.red, 
                    Text.RELATIVETOBOTTOM | Text.BOLD, "Courier", 10, 
                    "M" + getValue("rawtime")());
            }
            ***/

            
    if(vRet == 1) {
                
    drawShapeRelative(010Shape.UPTRIANGLE""Color.blueShape.RELATIVETOBOTTOM"P" getValue("rawtime"));
            } else if(
    vRet == -1) {
                
    drawShapeRelative(010Shape.DOWNTRIANGLE""Color.redShape.RELATIVETOBOTTOM"P" getValue("rawtime"));
            }



        }


    Matt Gundersen

    Comment


    • #3
      Alexis - you mean like this?

      This EFS draws a red line at the low of the last major Pivot and a red line at the high of the last major pivot.

      My question to you: What benefit does this provide? What is it telling me? ..??..??

      Picture:


      EFS:
      PHP Code:
      function preMain() {
          
      setPriceStudy(true);

          
      setDefaultBarFgColor(Color.blue0);
          
      setDefaultBarFgColor(Color.red1);
          
      setDefaultBarThickness(20);
          
      setDefaultBarThickness(21);

          
      setCursorLabelName("PivotH"0);
          
      setCursorLabelName("PivotL"1);

          
      setPlotType(PLOTTYPE_SQUAREWAVE0);
          
      setPlotType(PLOTTYPE_SQUAREWAVE1);

      }

      var 
      pivots = new GetPivotsStudy();
      var 
      vPivotH null;
      var 
      vPivotL null;

      function 
      main() {
          var 
      vRet pivots.getValue(GetPivotsStudy.PIVOTS);

          
          if(
      vRet != null) {

              
      // 1 is primary
              // 2 is major
              // 3 is intermediate
              // 4 is minor.
              // Negative means a lower 
              // Postivie means an upper.
              
      if(vRet == 1) {
                  
      vPivotH high();
              } else if(
      vRet == -1) {
                  
      vPivotL low();
              }
          }

          return new Array(
      vPivotHvPivotL);


      Matt Gundersen

      Comment


      • #4
        I modified the original mabar31.efs a little bit. The mabar31.efs is what started off this particular thread. Goto the very first post of this thread to see the screenshot and original source.

        This one adds Alert functionality. Whenever a W2, W4, W5, or C occures, and price crosses the 3/1 MA, an Alert will be generated to the alert list, a sound will be played, and optionally (it's commented out), an email can be sent.

        m.

        PHP Code:
        var vLen 3;
        var 
        vOff 1;

        function 
        preMain() {
            
        setStudyTitle(vLen "/" vOff);
        }

        var 
        elliott = new GetElliottStudy(3000505350);
        var 
        maH = new MAStudy(vLenvOff"High"MAStudy.SIMPLE);
        var 
        maL = new MAStudy(vLenvOff"Low"MAStudy.SIMPLE);

        var 
        nLastWave null;
        var 
        bInTrade false;

        function 
        PrintClose() {
           var 
        close(-1);
           
        *= 100;
           
        Math.floor(x);
           
        /= 100;
           
           return 
        x;
        }

        function 
        main() {
            var 
        vC close();
            var 
        vH maH.getValue(MAStudy.MA);
            var 
        vL maL.getValue(MAStudy.MA);
            var 
        vPrevC close(-1);
            var 
        vPrevH maH.getValue(MAStudy.MA, -1);
            var 
        vPrevL maL.getValue(MAStudy.MA, -1);
            var 
        nWave elliott.getValue(GetElliottStudy.WAVE);


            var 
        nState 0;
            var 
        nBarState getBarState();
            if(
        nBarState == BARSTATE_NEWBAR) {
                if(
        nLastWave != null) {
                    if(
        nLastWave == || nLastWave == || nLastWave == -|| nLastWave == -5) {
                        
        nState 1// long
                    
        } else if(nLastWave == -|| nLastWave == -|| nLastWave == || nLastWave == 5) {
                        
        nState = -1// short
                    
        }
                }

            }


            if(
        nWave != null)
                
        nLastWave nWave;

            if(
        nLastWave == null || vC == null || vH == null || vL == null)
                return;

            var 
        bColorOK false;

            if(
        nLastWave == || nLastWave == -2)
                
        bColorOK true;
            else if(
        nLastWave == || nLastWave == -5)
                
        bColorOK true;
            else if(
        nLastWave == || nLastWave == -4)
                
        bColorOK true;
            else if(
        nLastWave == || nLastWave == -9)
                
        bColorOK true;



            if(
        bColorOK == true) {
                if(
        vC vH) {
                    
        // drawShapeRelative(0, 20, Shape.UPTRIANGLE, "", Color.blue, Shape.RELATIVETOBOTTOM, "Shp" + getValue("rawtime"));
                    
        setBarBgColor(Color.lime);
                } else if(
        vC vL) {
                    
        // drawShapeRelative(0, 20, Shape.DOWNTRIANGLE, "", Color.red, Shape.RELATIVETOBOTTOM, "Shp" + getValue("rawtime"));
                    
        setBarBgColor(Color.red);
                }            
            }

            if(
        nState != 0) {
                if(
        nState == 1) {
                    if(!
        bInTrade) {
                        if(
        vPrevC vPrevH) {
                            
        bInTrade true;
                            
        drawTextRelative(-15PrintClose(), Color.whiteColor.blue,
                                
        Text.ONTOP Text.RELATIVETOBOTTOMnull12
                                
        "L" getValue("rawtime"));

                            
        Alert.playSound("warning.wav");
                            
        Alert.addToList(getSymbol(), "Potential Elliott Long"Color.blackColor.green);
                            
        // Alert.email("Potential Elliott Long on: " + getSymbol());
                        
        }
                    } else {
                        if(
        vPrevC vPrevL) {
                            
        bInTrade false;
                        }
                    }

                } else if(
        nState == -1) {
                    if(!
        bInTrade) {
                        if(
        vPrevC vPrevL) {
                            
        bInTrade true;
                            
        drawTextRelative(-15PrintClose(), Color.redColor.black,
                                
        Text.ONTOP Text.RELATIVETOBOTTOMnull12
                                
        "S" getValue("rawtime"));

                            
        Alert.playSound("warning.wav");
                            
        Alert.addToList(getSymbol(), "Potential Elliott Short"Color.blackColor.red);
                            
        // Alert.email("Potential Elliott Short on: " + getSymbol());

                        
        }
                    } else {
                        if(
        vPrevC vPrevH) {
                            
        bInTrade false;
                        }
                    }

                }
                
            } else {
                
        bInTrade false;
            }


            return;
            

        Matt Gundersen

        Comment


        • #5
          This EFS looks @ the major Elliott Waves (W5), and Major Pivots. Based on that, it extends (draws a line) where the last major high or low is located.



          PHP Code:
          function preMain() {
              
          setPriceStudy(true);

              
          setDefaultBarFgColor(Color.blue0);
              
          setDefaultBarFgColor(Color.red1);
              
          setDefaultBarThickness(20);
              
          setDefaultBarThickness(21);

              
          setCursorLabelName("PivotH"0);
              
          setCursorLabelName("PivotL"1);

              
          setPlotType(PLOTTYPE_SQUAREWAVE0);
              
          setPlotType(PLOTTYPE_SQUAREWAVE1);

          }

          var 
          elliott = new GetElliottStudy(3000505350);
          var 
          pivots = new GetPivotsStudy();

          var 
          vPivotH null;
          var 
          vPivotL null;

          function 
          main() {
              var 
          vPivot pivots.getValue(GetPivotsStudy.PIVOTS);
              var 
          nWave elliott.getValue(GetElliottStudy.WAVE);

              if(
          vPivot != null) {

                  
          // 1 is primary
                  // 2 is major
                  // 3 is intermediate
                  // 4 is minor.
                  // Negative means a lower 
                  // Postivie means an upper.
                  
          if(vPivot == 1) {
                      
          vPivotH high();
                  } else if(
          vPivot == -1) {
                      
          vPivotL low();
                  }
              } else if(
          nWave != null) {
                  if(
          nWave == 5) {
                      
          vPivotH high();
                  } else if(
          nWave == -5) {
                      
          vPivotL low();
                  }
              }



              return new Array(
          vPivotHvPivotL);


          Matt Gundersen

          Comment


          • #6
            Matt
            I am using the first of the Pivot efs (ie the one without the Elliott wave) and if you look at the attached you can see that the low pivot line is not switching to the new low Pivot (actually at this time it is a Smart Pivot).
            If I reload the efs it then moves the line to the new low P.
            is this happening because it is still a Smart Pivot? If that is the case why would it switch when I reload the efs even if the Pivot is still "Smart"?
            Alex
            Attached Files

            Comment


            • #7
              Alexis, this will be fixed in the final release.

              m.
              Matt Gundersen

              Comment

              Working...
              X