Announcement

Collapse
No announcement yet.

detecting higher highs

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

  • detecting higher highs

    is there a way to determine when price makes a higher high while trending up?
    thanks for any help.

  • #2
    the easiest way to code this is as follows.

    if (getBarState() == BARSTATE_NEWBAR) {
    lastKnownHigh = high();
    // This resets the control variable to the current high. It gets reset with every new bar so we can track NEW BAR NEWER HIGHS.
    }


    if ((high() > high(-1)) && (high() > lastKnownHigh)) {
    // This represents a NEW INTRA-DAY HIGH.
    lastKnownHigh = high();
    }
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      thanks brad,
      i'm not looking at intraday. i'm looking at history bars locating lower lows & lower highs and drawing colored bars in a separate window. i want to locate the bar where the 'higher' low occurs indicating a possible turn-around .
      not sure if this makes sense.

      Comment


      • #4
        Hi Brad,

        I created a new efs and pasted this code but I get the following error : Error: Failed to call function 'getBarState': not appropriate context 'global'. ? any ideas how to get this to work ?

        thankyou

        Originally posted by Doji3333 View Post
        the easiest way to code this is as follows.

        if (getBarState() == BARSTATE_NEWBAR) {
        lastKnownHigh = high();
        // This resets the control variable to the current high. It gets reset with every new bar so we can track NEW BAR NEWER HIGHS.
        }


        if ((high() > high(-1)) && (high() > lastKnownHigh)) {
        // This represents a NEW INTRA-DAY HIGH.
        lastKnownHigh = high();
        }

        Comment


        • #5
          Hoping Brad doesn't mind me jumping in,

          "getBarState()" needs to be called from within function main(){}

          Wayne
          Last edited by waynecd; 07-31-2014, 10:22 AM.

          Comment

          Working...
          X