Announcement

Collapse
No announcement yet.

Highest high

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

  • Highest high

    Hi,
    i am looking for a code, that adds a special condition to the code of the highest high study.
    The condition should be, that the highest high(-1) before the highest high(0) should be a peak with a left and right leg of 10 bars with lower bars.
    Is thsi possible? How to change the code below?
    Thanks

    /************************************************** **************************************************
    Copyright © eSignal, a division of Interactive Data Corporation. 2005. All rights reserved.
    This sample eSignal Formula Script (EFS) may be modified and saved under a new
    filename; however, eSignal is no longer responsible for the functionality once modified.
    eSignal reserves the right to modify and overwrite this EFS file with each new release.
    ************************************************** ************************************************** */
    function preMain() {
    setPriceStudy(true);
    setCursorLabelName("Highest High");

    var fp1 = new FunctionParameter("nInputLength", FunctionParameter.NUMBER);
    fp1.setName("Number of Bars");
    fp1.setLowerLimit(1);
    fp1.setDefault(20);
    }

    function main(nInputLength) {
    if(high(-nInputLength) == null) return;

    var i = 0;
    var hh = null;

    for(i = 0; i < nInputLength; i++) {
    if(i == 0) {
    hh = high(i);
    } else {
    hh = Math.max(hh, high(-i));
    }
    }
    return hh;
    }

  • #2
    Hi,

    What you are asking is possible to do, but you aren't clear on what you want returned under the various conditions.

    If hh(-1) has 10 lower bars on each side what should be returned?
    if hh(-1) doesn't have 10 lower bars on each side what should be returned?

    Steve

    Comment


    • #3
      Originally posted by smeyer55
      Hi,

      What you are asking is possible to do, but you aren't clear on what you want returned under the various conditions.

      If hh(-1) has 10 lower bars on each side what should be returned?
      if hh(-1) doesn't have 10 lower bars on each side what should be returned?

      Steve
      Good Question.

      The code HHV is looking for the last e.g. 60 bars.

      E.g. Bar 60 ist the highest bar.
      If the bar 61 back is higher than the 60. bar, it draws the line at the top of the 60. bar, also it`s no real peak.

      I want to draw only lines at real peaks. If the 61 bar back is a peak, the code should take this als the highest bar.
      If the 61. bar isn`t a peak(with 10 lower bars left and right), the code should take the next peak back. Perhaps bar 87. And then draw the line at the level of the top of this bar 87.
      Is this possible?
      Hope, you can understand my english.
      Thanks

      Comment


      • #4
        So what you really want is a study that will draw a line from a high with 10 lower bars on each side. No matter how far back that bar is.

        That is a different requirement than what the highest high code is designed to do.

        I've attached a file that will draw from a high with 10 bars lower on each side. Note that this may not be the highest high since the line was drawn.

        If you want to change to a different number than 10 bars, change the value on line 12.

        If you want to change the line color or properties, that's on line 44.

        Steve
        Attached Files

        Comment


        • #5
          GREAT!!! That`s want i want. Thank you very much.
          Do you have the same for "Major lows"?
          I know, i could change it myself, but perhaps you have written it yet.

          Comment


          • #6
            Here's one that draws a red line for a major valley.

            Steve
            Attached Files

            Comment


            • #7
              Thank you, Steve.
              Do you know, how to draw a vertical line from the "P" to improve recognizing the pivots at the main chart?
              Or to draw a point at the pivotbar at the main(Quote)chart?
              Thanks

              Comment


              • #8
                Here's a modified version of the peak efs that will draw a red verticle line at the bar with the peak.

                The code to do this is on line 47.

                Steve
                Attached Files

                Comment


                • #9
                  Steve,

                  great .efs there. Can you please tell or show how to keep the last instance of majorpeak or major valley so it still plots as well?

                  TIA,

                  Kirk

                  Comment


                  • #10
                    Kirk,

                    Here's a modified version of the efs that will allow you to keep the last X high pivots.

                    It now uses Function Parameters to set the number of high Pivots to display.

                    The default settings will display the last 2 high pivots.

                    There are also parameters to set the number of required lower bars on each side of the high, the line thickness, and the line color.

                    Steve
                    Attached Files

                    Comment


                    • #11
                      Highest high

                      I believe you'll find another efs that does the same thing within ESignal. Just Google fractal.efs. I had it modified to give me alarms when price approached either a High or Low fractal.

                      John

                      Comment


                      • #12
                        Thanks Steve,

                        you hit it right on the money!

                        kz

                        Comment


                        • #13
                          thanks John,

                          I'm checking out the fractal.efs you mentioned.

                          appreciate it.

                          kz

                          Comment


                          • #14
                            Kirk,

                            You're welcome. I hope you can use the example to learn some new techniques.

                            Steve

                            Comment


                            • #15
                              Steve,

                              Thanks for demonstrating new techniques.

                              The next attempt I'm making is how to attach a trendline between the previous two high points similar to:

                              PHP Code:
                              drawLineRelative (-ihigh(-i), ihigh(i),PS_DASHLineThicknessLineColor2); 
                              Obviously, that didn't quite do it!

                              I'm not sure how to "attach" the line to the high(i) and run it to the previous instance. Also didn't quite know how to use the "lineCount--" parameter.

                              Any help you can give will be much appreciated.

                              TIA,
                              Kirk
                              Last edited by zeller4; 10-30-2007, 05:38 AM.

                              Comment

                              Working...
                              X