Announcement

Collapse
No announcement yet.

identifying trend turnarounds

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

  • identifying trend turnarounds

    i can detect the lower lows in a downtrend, but need a way to identify the which low is the lowest value.
    can you give any examples of how to do this?
    many thanks,

  • #2
    you could use a simple FOR loop for this. All you have to to is tell this function how many recent bars you want it to review for the lowest low value.

    PHP Code:

    function fFindLL(vbars) {
     var 
    0vLL 999999999999;
     
     for (
    0> -vBarsx--) {
       
    vLL Math.min(vLLlow(x));
     }
      
      return 
    vLL;

    An example of using this function would be as follows

    PHP Code:

    //  I want to find the lowest low of the last 15 bars
    var LL15 fFindLL(15);

    //  I want to find the lowest low of the last 7 bars
    var LL15 fFindLL(7); 
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      BTW, if you wanted to know the lowest low AND which bar it happened on, then you would simply use this function. It returns an array with the lowest low and the bar # that returned the lowest low.

      PHP Code:

      function fFindLLnB(vbars) {
       var 
      0vLL 999999999999vBarID 0;
       
       for (
      0> -vBarsx--) {
         if (
      low(x) <= vLL) {
           
      vLL Math.min(vLLlow(x));
           
      vBarID x;
         }  
      // end of conditional if
       
      }  // end of for loop
        
        
      return new Array(vLLvBarID);

      You would access the returned values like this.

      PHP Code:

      var vLLB fFindLLnB(15);

      debugPrintln(" LL:"vLLB[0] +" Bar #:"+vLLB[1] ); 
      Hope this helps??
      Brad Matheny
      eSignal Solution Provider since 2000

      Comment


      • #4
        i'll explore that suggestion. basically looking for a series of lower lows and then a higher low(turn-around) bar that would occur today.
        thanks, brad.

        Comment


        • #5
          efs code for lower low

          thanks brad if you can look at this

          hopefully this will help resolve my issue.
          consider the code:

          // priorLow = priorTemp;
          if(close(-1) < close(-2) && close() > close(-1) && close(-1) < priorLow){
          vColor=Color.fushcia;
          priorTemp = close(-1);}

          [ prints fuschia bar]

          i need to be able to vary(decrease) the value in priorLow each time the "if" statement is true...using the value in close(-1).

          the 1st statement prevents the "if" from ever being true.
          unless commented out.
          thank you.

          Comment


          • #6
            Re: efs code for lower low

            Wouldn't this work for you?
            ----------------------------------------------

            i need to be able to vary(decrease) the value in priorLow each time the "if" statement is true...using the value in close(-1).

            if(close(-1) < close(-2) && close(0) > close(-1) && close(-1) < priorLow){
            vColor=Color.fushcia;
            if (close(-1)<priorLow) {priorLow = close(-1);}
            }
            Last edited by AssetHound; 04-08-2010, 07:26 PM.

            Comment


            • #7
              Re: efs code for lower low

              Originally posted by peterjerome
              thanks brad if you can look at this

              hopefully this will help resolve my issue.
              consider the code:

              // priorLow = priorTemp;
              if(close(-1) < close(-2) && close() > close(-1) && close(-1) < priorLow){
              vColor=Color.fushcia;
              priorTemp = close(-1);}

              [ prints fuschia bar]

              i need to be able to vary(decrease) the value in priorLow each time the "if" statement is true...using the value in close(-1).

              the 1st statement prevents the "if" from ever being true.
              unless commented out.
              thank you.
              I would probably do it like this. Remember, you're going to have to reset the "priorTemp" value when every new low series ends. If you don't reset it, you're making the assumption that every new low series will be lower than the last. Thus, it will only find LOWER low series that setup as you indicate in your code.

              So, onto how I would do this..

              PHP Code:

              var priorLow 99999999;

              function 
              main() {

              //  RESET Low Pattern on a HIGH Series
              if ((close(-1) > close(-2)) && 
                  (
              close() > close(-1))
              ) {
                
              priorLow 99999999;
              }


              //  New Low Pattern : Low Series
              if ((close(-1) < close(-2)) && 
                  (
              close() > close(-1)) && 
                  (
              close(-1) < priorLow)
              ){
                 
              vColor=Color.fushcia;
                 
              priorLow close(-1);
              }

              return;
              }  
              // end of main 
              This way, you are tracking the "low series" when they happen and resetting the low series "priorLow" value with any "high series" - thus allowing any new "low series" to initiate again.
              Brad Matheny
              eSignal Solution Provider since 2000

              Comment


              • #8
                OK...thanks brad. i'm going to check this out. i appreciate your suggestions.

                Comment


                • #9
                  trend turn-around

                  [QUOTE]Originally posted by Doji3333
                  [B]BTW, if you wanted to know the lowest low AND which bar it happened on, then you would simply use this function. It returns an array with the lowest low and the bar # that returned the lowest low.

                  [php]

                  function fFindLLnB(vbars) {
                  var x = 0, vLL = 999999999999, vBarID = 0;

                  for (x = 0; x > -vBars; x--) {
                  if (low(x) <= vLL) {
                  vLL = Math.min(vLL, low(x));
                  vBarID = x;
                  } // end of conditional if
                  } // end of for loop

                  return new Array(vLL, vBarID);
                  }
                  **************************************************
                  brad, my 'trend turnaround' was based on an assumption ...'that the OLDEST data was tested first'. the opposite is true..it begins with the NEWEST data...so testing for a 'lower low' requires a 'higher low' in the PAST. this makes the actual 'turn around' signal an outdated event when it happens.
                  thanks,
                  peter.

                  Comment

                  Working...
                  X