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.

Scan for 50 ema bounce

Hello - am trying to create a scan that will help in finding charts where the price is in a steady uptrend and has pulled back to the 50 ema. the strategy is to go long at the 50 ema and exit at the previous high. pretty basic setup. below is what I have as a scan, the syntax checks out ok but the scan is not returning anything. what am i missing.

[type is stock] and [sma(20,volume) > 400000]
and [ADX Line(14) > 30.0]
and [SCTR >70]
and [60 days ago Close > EMA(50,close)*1.10]
and [yesterdays Close =EMA(50,close)]
and [country is US]


  • A few comments:

    It's very unlikely the close will ever be exactly equal to the ema.

    You could try testing for close within x per cent of the ema:

    and [close < ema(50,close)*1.01]
    and [close > ema(50,close)*.99]

    You can vary the 1.01 and .99 to suit.

    Or, you could test for a close crossover of the ema

    and [ema(50,close) x close]

    (this says the ema crosses above the close - same thing as close crosses below the ema, but the "x" operator means "crosses above", so you have to get the order of the terms right)

    Or, you could test for the ema inside the range of the current bar:

    and [ema(50, close) < high]
    and [ema(50,close) > low]

    Also, when checking for close above the ema in the past, try using the same look back for both

    and [60 days ago close > 60 days ago ema(close,50)]

    Or, you could just check for a rising ema - if the ema is rising, price must have been above it:

    and [ema(50, close) > 20 days ago ema(50,close)]

    You can vary the 20 day look back to suit.

    Finally, I would recommend you get the close vs ema condition to work first, then add the other indicator conditions.
  • Thanks Mark. the below scan based on your suggestions is yielding decent results

    [type is stock] and [sma(20,volume) > 400000]
    and [60 days ago close > 60 days ago ema(50,close)]
    and [close < ema(50,close)*1.01]
    and [close > ema(50,close)*.99]
    and [country is US]
    and [SCTR >65]
  • Great!

    A couple of things to keep in mind. The number and quality of results will change over time, depending on what the market is doing. For instance, in a bull market, if the market drops for a couple of weeks, you should get many more hits. If the market continues to rise, you will get fewer.

    You are more likely to get "mainstream" stocks when the whole market heads down, because even the leading stocks will be taking a breather then. When the market is heading up, more hits will be either stocks past their prime, or stocks generally lagging. Your SCTR condition more or less accounts for that.

    A style suggestion: it's "good form" and your scan will run a little faster if you put all your "universe" conditions - i.e., the more general characteristics of the stock - type, country, volume SCTR - all together at the top of the scan, so

    // universe
    [type is stock]
    and [country is US]
    and [SCTR >65]
    and [sma(20,volume) > 400000]

    // set up
    and [60 days ago close > 60 days ago ema(50,close)]
    and [close < ema(50,close)*1.01]
    and [close > ema(50,close)*.99]

    My understandng is, if you put the universe conditions at the end, the scan looks for the set up in every stock in the database. If you put the universe first, it looks only at those stocks.
Sign In or Register to comment.