Announcement

Collapse
No announcement yet.

Short cut required

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

  • Short cut required

    Hi Alex,
    I was hoping that you could assist me with a shorter method to write the following efs formula, for instance I would like to write the efs to find the highest or lowest close or high or low or open for the past two hundred and plenty bars and instead of writing as follows in the example
    var Closemax = Math.max(close(0),Close(-1),close(-2),etc until,close(-199))
    which would take up a lot of space.......how could I write the code to achieve the same result.
    I hope that I have made myself clear in explaining as possible and would sincerely appreciate your assistance.
    Regards Kevan

  • #2
    Kevan
    See this post.
    As an aside in EFS2 the required syntax will be much easier since all you would need to write is
    var highestC = upperDonchian(200,close());
    Alex

    Comment


    • #3
      Short cut help

      Hi Alex,
      var highestC = upperDonchian(200,close());
      simple as that, I will give it a try and see if it works. So I take it that if I want to find highest or lowest high or low or open I will just change as follows:
      var highestH = upperDonchian(200,high()); or
      var lowestL = lowerDonchian(200,low());
      Thanks for the help and let me know if I am correct in my assumption.
      Regards Kevan

      Comment


      • #4
        Kevan
        Yes simple as that.
        As to you other examples highestH is already the upper Donchian() when the source is not defined and same for lowestL which is lowerDonchian()
        Alex

        Comment


        • #5
          Short cut required

          Hi Alex, could you please give me an example to work from including the complete script as it would appear in a complete efs formula as I am not sure what you mean by the source not being defined. I tried to enter the following
          var highestC = upperDonchian(200,close()); instead of
          var Closemax = Math.max(close(0),Close(-1),close(-2),etc until,close(-199));
          and I got the message Reference error upperDonchian is not defined.
          I thank you for your help as I am still a bit new to efs
          Regards Kevan

          Comment


          • #6
            Kevan
            The enclosed EFS2 code returns the highest Close in the last 200 bars as shown in the image below
            Alex

            PHP Code:
            function preMain() {

                
            setPriceStudy(true);
                
            setStudyTitle("HighestClose");
                
            setCursorLabelName("HighstC"0);
                
            setDefaultBarFgColor(Color.blue0);
            }

            function 
            main() {

                return 
            upperDonchian(200,close());

            Comment


            • #7
              Kevan
              If you do not specify a source for the Donchian channel then the Donchian channel is calculated by default on the highest high and lowest low over the specified period so upperDonchian(200) will return the highest high over 200 bars and lowerDonchian(200) will return the lowest low over the same period
              Alex

              Comment

              Working...
              X