Announcement

Collapse
No announcement yet.

Multiple Swingline Study

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

  • Multiple Swingline Study

    Hi,

    I was putting together an EFS to help me get multiple types of pivots and draw multiple types of swinglines (Minor, Intermediate, Major, Primary) for a larger project. After running the EFS I noticed that it really helped to see the wave structures forming. Since it may be of general interest, I am posting it.

    Note that if you use the default settings of % movement for a pivot type (set to 0) the EFS will set these values based on the interval of the chart. This isn't perfect by ANY means...the range of volatilities for each symbol means it will never be perfect for all symbols (at least with this simple method), but I also didn't spend a lot of time figuring out the correct values for weekly and monthly intervals.

    If anyone puts the effort in to figure out better generic numbers let me know and I will plug them into the EFS. If anyone gets really jazzed by this and starts a Symbol/Interval basis for setting the numbers I could always look up the data in a file and set the numbers according to that data.

    Anyway - the bottom line is you likely will have to override the default settings for % movement (via Edit Study Parameters)

    Hope this is of interest, and as remember - this is a freebie provided as is and without any promise that it is usable in any real way.

    Garth
    Attached Files
    Garth

  • #2
    Hi Garth,

    Neat piece of code, thanks!

    Comment


    • #3
      gspiker
      Down Loaded you efs
      Ran it against SMH holder
      Placed a chart of it on my HAL GROUP
      It looks very interesting.
      Will have to follow it for awhile
      Larry Dudash
      HAL at
      http://share.esignal.com/groupconten...r=&groupid=549

      Comment


      • #4
        Garth,

        Regarding your new FunctionParameter declarations in the code

        PHP Code:
                aFPArray[x] = new FunctionParameter("nNum"FunctionParameter.NUMBER);
            
        withaFPArray[x] ) {
                
        setName("# of bars for Pivot");
                
        setLowerLimit(1);
                
        setDefault(5);
            }
            
        x++; 
        I believe you can move the x++; step up to the with statement such that it looks like this

        PHP Code:
            aFPArray[x] = new FunctionParameter("nNum"FunctionParameter.NUMBER);
            
        withaFPArray[x++] ) {
                
        setName("# of bars for Pivot");
                
        setLowerLimit(1);
                
        setDefault(5);
            } 
        ... and it still does the same thing (I have tried before in something similar and I believe it uses the current value of x in the parenthesis before incrementing). This way you do not have to have a seperate line to increment the x value.

        I am at a remote location currently and cannot try it out, but I am pretty sure it will work fine.

        Regards,

        Comment


        • #5
          Hi Steve,

          Thanks for the post. Yes, it should, x++ is a post increment so it should evaluate x and then increment it.

          I think it comes down to a matter of style. I like having the ++ clearer on its own line...but either way should work. As would doing ++x on all but the first declaration.

          I can't take credit for the Function Parameter code. I noticed this is how Chris did it in one of his Study's and it was obvious that it allowed for much more flexibility when adding or deleting new Function Parameters.

          Garth
          Garth

          Comment


          • #6
            Garth,

            Thanks for the note back. I do a lot of incrementing for array definition variables in some of my code and I have come to like that method. Like you said though, just a matter of style / what you get used to.

            Regarding the way Chris has put this together, it is very nice IMHO, as it allows you to move the parameters around within or between code with very little renumbering.

            Comment


            • #7
              Steve,

              Regarding the way Chris has put this together, it is very nice IMHO, as it allows you to move the parameters around within or between code with very little renumbering.
              Exactly why I stole the concept ;-)

              It got me thinking too of if it would be possible to create a string that could be used as the paramter list for main(), such that you could define the parameters asyou set up your Function Parameters. I didn't have high hopes of it working, but if it did it would save some pain. So I played with just making a string:

              PHP Code:
              aFPArray[x] = new FunctionParameter("nNum"FunctionParameter.NUMBER);
              withaFPArray[x] ) {
                      
              setName("# of bars for Pivot");
                      
              setLowerLimit(1);
                      
              setDefault(5);
                  }
                  
              sParamList sParamList "nNum";
                  
              x++; 
              etc...and then

              main(sParamList)

              But this didn't work (I didn't think it would). But I did have some hopes of this working:
              PHP Code:
              sMainState "main("
              aFPArray[x] = new FunctionParameter("nNum"FunctionParameter.NUMBER);
              withaFPArray[x] ) {
                      
              setName("# of bars for Pivot");
                      
              setLowerLimit(1);
                      
              setDefault(5);
                  }
                 
              sMainState sMainState "nNum,";
                  
              x++;
                 
              sMainState sMainState "){"

              eval(sMainState

              But that didn't work either. A shame.

              Garth
              Garth

              Comment

              Working...
              X