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.

What am I Missing?

I want a scan to identify when the 13 week ema crosses above the 34 week ema. The scan syntex says the scan is correct but when I run the scan it says "no data in the tables." Could someone help me identify what is incorrect with this scan?

[type is stock]

// Scan to identify when the 13 week EMA crosses above the 34 week EMA

and [group is SP600]
and [group is SP400]

//Moving Averages are correctly Positioned
and [weekly EMA(13) > weekly EMA (34)]

//Moving Average Cross over
and [weekly EMA(13) x weekly EMA(34)]

and [ EMA(13,Close) > 0 days ago EMA(34,Close)]

Thanks,
Bryce A

Comments

  • Hi @Bryceand1, welcome aboard.

    This is the error:


    and [group is SP600]
    and [group is SP400]


    No symbol belongs to BOTH the sp6 and sp4. But some symbols belong to sp4 OR sp6.

    So, the first line should be

    [ [group is sp600] or [group is sp400] ]

    You need the extra brackets to isolate the OR statement, so the scan sees that the OR applies only to the alternative within the extra brackets. If you don't isolate the OR, the scan will return symbols for any condition that is true in the whole scan.


    Also, this is redundant:

    //Moving Averages are correctly Positioned
    and [weekly EMA(13) > weekly EMA (34)]

    - probably OK if you leave it in, because it should be true if the next line is, but not necessary


    This is also redundant, for the same reason:

    and [ EMA(13,Close) > 0 days ago EMA(34,Close)]


    So the whole thing would be:

    // begin 13-34 week crossover scan

    // universe to scan
    [ [group is sp600] or [group is sp400] ]

    //Moving Average Cross over
    and [weekly EMA(13, close) x weekly EMA(34, close)]

    // end scan

    Pretty simple after all. I like how you thought things through, though, and documented everything. Great form! Easy to follow your thinking and that makes it easier to find the sticky points.

    Just a note:

    weekly EMA(13) is OK, because the default value (what the scan engine assumes you mean when you don't specify) is the close. But it's good form to specify, so there is no question what you are asking for - e.g. if you misremember the default, it could take a while to find the problem, if there is one.


  • Mark, Thank you for helping identify my mistake. I am new at scans so your knowledge and experience is so appreciated. Thank you again
Sign In or Register to comment.