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.

Scanning daily, weekly, and monthly time frames

I'm wondering whats wrong with my scan. I'm trying to create a scan that has a close below the 20 SMA across daily, weekly, and monthly times frames. However the scan results show a close below the daily time frame only. Any suggestions? Thank you.

//Equity Preferences
[optionable is true]
and [todays close > 30.00]
and [Volume > 5,000,000]
and [Volume > yesterday's volume]

//Moving Average Across Daily-Weekly-Monthly
and [todays close < SMA(20)]
and [weekly close < SMA(20)]
and [monthly close < SMA(20)]

Comments

  • markdmarkd ✭✭✭
    Your current scan asks for the current close - which is the same for the daily close, the weekly close and monthly close - to be below the sma of the daily close.

    Probably what you want is to ask for is the current close below the daily sma, the weekly sma and the monthly sma. For that, you would write

    // current close below daily sma
    and [close < sma(20, close)]

    // current close below weekly sma
    and [close < weekly sma(20, weekly close)]

    // current close below monthly sma
    and [close < monthly sma(20, monthly close)]


    The default time frame for all terms that could have a time frame is daily (first condition), so you don't have to include a "daily" modifier (but no harm if you do). If you want to reference a different time frame (second and third conditions), you have to include a modifier for each term that could have a time frame - in this case, "sma( )" and "close".

    For the second two statements, you could include a "weekly" or "monthly" modifier for "close" on the left term, but the value would be the same as the daily close because the scan engine considers the current value as the closing value for each time frame even if it is not the end of the week or month - it doesn't look back to the previous week or month to see what the value was on the last day of that period.

    Note also that the values for the weekly and monthly smas are not the FINAL values for that sma if the scan is run on a day that is not the last day of the week or month after the close. So, if on the day of the scan the close is very close to its weekly or monthly sma (as calculated on that day), the results may not be completely accurate - that is, the close might be above or below the monthly sma, for instance, but at the end of the month, if you run the scan again, you might not get the same hit(s). Probably not a big problem in most cases, but just something to know.
  • Awesome post. Thanks for the clarification!!
Sign In or Register to comment.