local extrema detection

Discussion in 'Strategy Building' started by ssrrkk, Nov 13, 2011.

  1. kut2k2

    kut2k2

    Exactly one bar as a matter of fact. :)
    Thanks for backing up my WMA suggestion. :cool:
     
    #21     Nov 14, 2011
  2. jprad

    jprad

    Why stop with just the adjacent bars?

    If a given high/low is above/below the adjacent bars it is, by definition, a local extrema.

    If you look at just the immediately adjacent bars the "strength" of your extrema is 1. By extension, an extreme point that's greater than 2 bars on either would have a strength of 2 and so on.

    That logic is the core for pretty much any zig-zag implementation. I'm sure there's at least some pseudo code on the 'Net somewhere.
     
    #22     Nov 15, 2011
  3. ssrrkk

    ssrrkk

    Okay thanks -- this is precisely what is described in the second paragraph of my original post (N-th ordered centered differences). But assigning a "strength" is a neat idea. I will do that.
     
    #23     Nov 15, 2011
  4. Yeah, strength is a good idea. I used it when creating horizontal support/resistance lines. For resistance, i needed peaks. To detect peaks i gave it back strength and forward strength. Back strength is how many bars are lower than the high of that bar before it and forward strength is how many bars are lower than the high after that bar. The forward strength is also the length of the resistance. Well, for detecting highs it's a good idea to give them backward and forward strengths and then apply some sort of exponential weight increase to a cumulative "strength" score. This means if it only has backward strength of 1 (meaning there's a higher high only 2 bars before this one), it doesn't add much to the cumulative, if at all. A backward strength of 20 however adds quite a lot. Pick your curve for weighing them, it's subjective after all.
     
    #24     Nov 15, 2011
  5. jprad

    jprad

    You're right, your second paragraph had already touched on this. I stopped reading once you mentioned smoothing in your first, my apologies.
     
    #25     Nov 15, 2011
  6. ssrrkk

    ssrrkk

    No apologies necessary -- you made me realize how to use those multiple differences: by assigning strengths. That's a very useful idea. Thanks.
     
    #26     Nov 15, 2011
  7. ssrrkk

    ssrrkk

    I implemented the 5 minute centered difference aka zig zag method -- attached as a png. I also used strength to distinguish between different peaks -- the arrows show the sma crossings following a peak, color-coded by different peak categories. This is the kind of thing I was after. Even though this is using a centered difference, it can still be used as a real time signal but with a 3 minute delay. Anyway, thanks for your suggestions!!
     
    #27     Dec 4, 2011
  8. The simple way, about 20 SLOCs in ESignal script. I used NQ tuning, probably be better tuned specifically to ES. Times Pacific. Lag may be as fast as a minute, but sometimes slower than yours.
     
    #28     Dec 4, 2011