Announcement

Collapse
No announcement yet.

Key Reversal Bar Study

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

  • Key Reversal Bar Study

    If current bar high is higher than previous 5 bars high
    and
    current bar close, lower than previous 1 bar close
    then
    draw round colored dot at the top of current bar

    If current bar low is lower than previous 5 bars low
    and
    current bar close, higher than previous 1 bar close
    then
    draw round colored dot at the bottom of current bar

    (Tradestation offers this Key Reversal Bar study in their basic studies)

    Can someone help me with efs study. I tried and get lots of syntax errors.

    Thanks and your help is very much appreciated.

  • #2
    Can someone help me with this efs file.

    Thanks
    Last edited by bandraguy; 10-07-2006, 10:43 AM.

    Comment


    • #3
      Originally posted by bandraguy
      Can someone help me with this efs file.

      Thanks
      You did not attach an efs file. If you are looking to create an efs, there are several out there that may meet your needs.

      I found these three links to different efs files using the Search tool with the following key* AND reversal*







      I hope this helps.

      Comment


      • #4
        stevehare2003

        I am just looking to do the following:


        If current bar high is higher than previous 5 bars high
        and
        current bar close, lower than previous 1 bar close
        then
        draw round colored dot at the top of current bar

        If current bar low is lower than previous 5 bars low
        and
        current bar close, higher than previous 1 bar close
        then
        draw round colored dot at the bottom of current bar

        Your help is appreciated, thank you.

        Comment


        • #5
          bandraguy,

          Did you look at the links I provided to see if they would work for you?

          I try and help people help themselves. Assuming you tried to do this, I went ahead and coded your request. I hope this is what you wanted and it works well for you.

          PHP Code:
          /***********************************************
          Written by Steve Hare for bandraguy on 10/7/2006
          Use and/or modify this code freely. If you redistribute it
          please include this and/or any other comment blocks and a 
          description of any changes you make.                      
          ***************************************************/
          function preMain() {
           
          setPriceStudy(true);
           
          setStudyTitle("bandraguy Key Reversal");
           
          setShowCursorLabel(false);
           
          setShowTitleParameters(false);
          }

          function 
          main() {

           
          //If current bar high is higher than previous 5 bars high
           
          var condition1 high(0)>Math.max(high(-1),high(-2),high(-3),high(-4),high(-5));
           
           
          // If current bar close, lower than previous 1 bar close
           
          var condition2 close(0)<close(-1);
           
           
          //if both are true, draw round colored dot at the top of current bar  
           
          if(condition1 && condition2){
            
          drawShapeShape.CIRCLEAboveBar1Color.red);
           }
           
           
           
          // If current bar low is lower than previous 5 bars low
           
          var condition3 low(0)<Math.min(low(-1),low(-2),low(-3),low(-4),low(-5));
           
           
          // If current bar close, higher than previous 1 bar close
           
          var condition4 close(0)>close(-1);
           
           
          //if both are true, draw round colored dot at the bottom of current bar 
           
          if(condition3 && condition4){
            
          drawShapeShape.CIRCLEBelowBar1Color.red);
           }

          Here is a Screenshot:




          You can download the efs from here:
          Attached Files

          Comment


          • #6
            Hi Steve,

            thanks for that, also liked that price arrow code (have added price by side of arrow from last trade.efs).

            Paul.

            Comment


            • #7
              stevehare2003

              I must thank you for what you did for me.

              Indeed, I tried to code this using esignal formula wizard. Somehow, I couldn't create a variable and kept giving me syntax error.

              Also, I checked other reversal efs files, they were all with different conditions.

              Your screenshot and code is very much appreciated.

              Thanks again,

              bandraguy

              Comment


              • #8
                Hi bandraguy,

                You are most welcome, I am glad this helped out.

                Originally posted by bandraguy

                I must thank you for what you did for me.

                Indeed, I tried to code this using esignal formula wizard. Somehow, I couldn't create a variable and kept giving me syntax error.

                Also, I checked other reversal efs files, they were all with different conditions.

                Your screenshot and code is very much appreciated.

                Thanks again,

                bandraguy

                Comment


                • #9
                  Originally posted by pmurraymc
                  Hi Steve,

                  thanks for that, also liked that price arrow code (have added price by side of arrow from last trade.efs).

                  Paul.
                  Hi Paul,

                  You are most welcome. FWIW, there is a similar version I put together last year that puts the price on top of the arrow here and .here. Perhaps it will give you some ideas.

                  Comment


                  • #10
                    bandraguy

                    Indeed, I tried to code this using esignal formula wizard. Somehow, I couldn't create a variable and kept giving me syntax error.
                    The best thing to do if you have a problem with your code is to post it so that others can show you how to resolve it.
                    Since you tried to use the Formula Wizard and had some problems I created two simple examples (that you may want to keep for future reference) to illustrate how to use the Formula Wizard to identify the upper key reversal bars. The same logic would then be used for the lower key reversal bars.
                    In the first example the condition checks for the high of the current bar to be higher than the high of each of the previous 5 bars and for the current close to be lower than the prior close. The logic in this method is very similar to the one used in the first two links provided by Steve.



                    In the second example instead the condition checks for the high of the current bar to be higher than the prior value of the 5 period Upper Donchian channel and for the current close to be lower than the prior close.



                    Either method shown will return the same result.
                    As you seem to have been using eSignal for a while you may find it to your benefit to learn how to program in efs as that will considerably increase your ability to make full use of the program. If you are interested then you may want to start by reviewing the JavaScript for EFS video series. That will provide you with a thorough introduction to programming in JavaScript which is at the foundation of EFS. Then go through the EFS KnowledgeBase and study the Help Guides and Tutorials which will provide you with the specifics of EFS.
                    Alex

                    Comment


                    • #11
                      Alexis,

                      Thanks for your suggestion, I'll will certainly do just that.

                      Meanwhile, can you help me make this change in the following code:

                      //If current bar high is higher or equal to previous 1 bar and higher than previous 4 bars//

                      var condition1 = high(0)>Math.max(high(-1),high(-2),high(-3),high(-4),high(-5));

                      I get syntax error, when I code like this:

                      var condition1 = high(0)>=Math.max(high(-1)) && >(high(-2),high(-3),high(-4),high(-5));

                      Thanks for your help.

                      Comment


                      • #12
                        bandraguy

                        Meanwhile, can you help me make this change in the following code:
                        //If current bar high is higher or equal to previous 1 bar and higher than previous 4 bars//
                        That can easily be done using the Formula Wizard and the first example I provided in my previous reply
                        All you need to do is change the operator from > to >= in the first condition (see the section annotated in red in the following image)
                        Alex

                        Comment

                        Working...
                        X