New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

Pullback for multiple bar drops

Hi. I am trying to enhance my pullback criteria. I would like it to be a range of daily bars say....3-8 bars that pull back to a rising 20ma.

Is there a simple way to do this. I have it set up for 3 bars, but I would like to see results that fall between 3 and 8 bars. So any pullback that is either 3 or 4 or 5 or 6 or 7 or 8 bars to the 20ma.

and [high < 1 day ago high]
and [1 day ago high < 2 day ago high]
and [2 day ago high < 3 day ago high]
and [low>=sma(20,close)]
and [sma(20,close) > 1 day ago sma(20,close)]
and [volume>75000]



  • markdmarkd mod
    edited December 2021
    You might want to tweak this a little, but here's one way:

    [group is sp500]
    // MA 20 is rising
    and [sma(20,close) > 3 days ago sma(20,close)]

    // today's low crossed MA 20
    and [sma(20,close) x low]

    // closes have been lower at least 3 but less than 9 consecutive days
    and [Streak Down(close) > 2]
    and [Streak Down(close) < 9]

    // optional
    rank by [Streak Down(close)]

    You could change streak down from close to low, maybe.

    If you just want consecutive down closes or lows ABOVE the rising MA 20, omit the crossover and use

    and [low > sma(20,close)]


    Note you might not always get results. Or in some markets you will get too many results. You might want to concentrate on specific indexes or sectors or market caps, etc.

    There is also a Streak Up. Similar functions are documented here:
  • That's great I will give it a try and see. Much appreciated!
  • Streaks are good for some things. Sounds like that is what is being asked for on this request. Another function to be aware of is the Count function. The Count Up and the Count Down are used to find situations like X of Y.

    Count Down defaults to:

    and [Count Down(20, close) > 10]

    This is asking the scan engine to look at the last 20 periods of the Close, in this example, and show symbols from my universe that were down 11 to 20 of the 20 periods.

    You can pick indicators to use as well, so you aren't just limited to Price or volume in the query.

  • Count Down is a good suggestion - less specific, so likely to get more hits.

    I think I would add a test for most recent close is the lowest:

    and [close = min(x, close)]

    Count Down doesn't necessarily imply directionality the way streak does, although, if the number is high enough it should. Still, the range could include a turn up near the end and still get picked up by Count Down.
Sign In or Register to comment.