Announcement

Collapse
No announcement yet.

Highest High Subset

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

  • Highest High Subset

    Hi,

    I'd like to get the highest high and plot it's value for, say, Bar 21 through 30. I've been able to get something that works.

    Do any of the EFS Gurus have a faster, more elegant solution ? Is there something available in E-signal that can do this better ?

    And yes, this is just checking for 30. I do it again for each Bar, to 21.

    Best Regards,

    Glenn


    if( ( high(-30) >= high(-29) ) &&
    ( high(-30) >= high(-28) ) &&
    ( high(-30) >= high(-27) ) &&
    ( high(-30) >= high(-26) ) &&
    ( high(-30) >= high(-25) ) &&
    ( high(-30) >= high(-24) ) &&
    ( high(-30) >= high(-23) ) &&
    ( high(-30) >= high(-22) ) &&
    ( high(-30) >= high(-21) ) )
    {
    Y = high(-30);
    cc = formatPriceNumber(Y);
    drawTextRelative(-30,high(-30),cc,Color.aqua,null,Text.CENTER,"Calibri",10,0) ;

  • #2
    Y = Math.max(
    high(-30),
    high(-29),
    high(-28),
    high(-27),
    high(-26),
    high(-25),
    high(-24),
    high(-23),
    high(-22),
    high(-21)
    )

    Y will be be the highest high of bars -21 thru -30

    Comment


    • #3
      I'm working on something similar to this. You could accomplish what fastflyer wants to do with this as well. Correct?

      var xValue = hhv(10, high());
      var highValue = xValue.getValue(-21);

      Once the series in the first statement is created, in an initialization loop, you would only need the second statement to access individual values as needed in other parts of the script.

      Still trying to learn. Thanks.

      Comment


      • #4
        Thanks David

        Thanks David Loomis,

        I tried, really, about a dozen times to reply and the system keeps returning an internet error message saying it can't find the web site. Thought I'd give this a try.

        Much more elegant, yes. I know just a little programming just trying to monkey along with what I see listed and try to stich something together.

        I've rarely been able to get an idea of mine coded by myself. I'm more grateful than y'all can imagine for the help of the Gurus. And Thanks again to Alexis Montenegro and Steve Hare. They already know they are my heros, now you too as well David.

        GestRegards,
        Glenn Swiatek

        PS For the E-signal group, if you would like any user feed back on this message board I'm available to tell you when I get error messages. Like just now, after I logged in to write this, when I hit the submit button, it asked me for my login stuff again. I've noticed as long as I've posted questions for this to be the case. ( I always copy my posting, knowing I'll have to paste it in again )

        Comment


        • #5
          Test in ESignal Exhibited Unexpected Results

          I tested what was presented in this thread and got the same value for highest() and hhv(), neither of which matched the Math.Max value.

          What is going on?

          ---------------

          function preMain(){
          setPriceStudy(true);
          setStudyTitle("Test ESignal");
          }

          function main(Length) {

          if(getCurrentBarIndex()==0)
          {

          debugPrintln("hhv(-21):"+hhv(10, -21));
          debugPrintln("highest(-21):"+highest(10, -21));

          Y = Math.max(
          high(-30),
          high(-29),
          high(-28),
          high(-27),
          high(-26),
          high(-25),
          high(-24),
          high(-23),
          high(-22),
          high(-21)
          );
          debugPrintln("Y="+Y);
          }

          return;
          }
          ---------------
          Attached Files

          Comment


          • #6
            Re: Test in ESignal Exhibited Unexpected Results

            geodepe
            As with most series functions that accept a series as a source [eg sma(), mom(), rsi(), macd(), etc) if this is not passed the function will implicitly use the close() series as the default.
            If you review the examples (and related comments) included in the EFS KnowledgeBase articles for hhv(), highest(), llv() and lowest() you will see that they return the highest or lowest Close when no series is passed
            In your code example the following lines
            PHP Code:
            debugPrintln("hhv(-21):"+hhv(10, -21));
            debugPrintln("highest(-21):"+highest(10, -21)); 
            should have been
            PHP Code:
            debugPrintln("hhv(-21):"+hhv(10high(), -21));
            debugPrintln("highest(-21):"+highest(10high(), -21)); 
            to match the values returned by Math.max
            You can find further examples of the syntax used by the efs2 functions in this thread
            Alex


            Originally posted by geodepe
            I tested what was presented in this thread and got the same value for highest() and hhv(), neither of which matched the Math.Max value.

            What is going on?

            ---------------

            function preMain(){
            setPriceStudy(true);
            setStudyTitle("Test ESignal");
            }

            function main(Length) {

            if(getCurrentBarIndex()==0)
            {

            debugPrintln("hhv(-21):"+hhv(10, -21));
            debugPrintln("highest(-21):"+highest(10, -21));

            Y = Math.max(
            high(-30),
            high(-29),
            high(-28),
            high(-27),
            high(-26),
            high(-25),
            high(-24),
            high(-23),
            high(-22),
            high(-21)
            );
            debugPrintln("Y="+Y);
            }

            return;
            }
            ---------------

            Comment

            Working...
            X