Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Scan Appears to be Calculating % EMA Values Incorrectly

Hi, following are my two scans:

SCAN 1:
[type is stock]
and [[exchange is NYSE] or [exchange is NASDAQ]]
and [sma(50,volume) > 100000]
and [Close > 5]
and [Weekly PctDiff(weekly EMA(26,close), 1 week ago weekly EMA(26,close)) >= 2]
and [Weekly PctDiff(1 week ago weekly EMA(26,close), 2 weeks ago weekly EMA(26,close)) >= 2]
and [favorites list is not 5]
and [favorites list is not 11].

SCAN 2:
[type is stock]
and [[exchange is NYSE] or [exchange is NASDAQ]]
and [sma(50,volume) > 100000]
and [Close > 5]
and [Weekly PctDiff(weekly EMA(26,close), 2 weeks ago weekly EMA(26,close)) >= 3]
and [Weekly PctDiff(2 weeks ago weekly EMA(26,close), 4 weeks ago weekly EMA(26,close)) >= 3]
and [favorites list is not 5]
and [favorites list is not 11].

Stock symbol MTCH appears to meet the criteria (lists 5 & 11 are empty) for both scans but is not included in the scan results. Can you help me understand why?

(For clarification, if I ran this scan on Saturday, 2/24/18 and am looking at the weekly chart, would one week ago be the week of 2/19 or 2/12 for determining the weekly EMA? Same question for two and four weeks ; which date matches each look back?)

• mod
edited February 26
See what happens if you add the "weekly" modifier to "close" in all the ema expressions, e.g.

weekly ema(26, weekly close)

My understanding is, if you run the scan after the close on Friday, and before Monday's open, or after Monday's open with the scan date set for the previous Friday,

weekly (ema(26, weekly close)

would refer to the week just ended (so 2/19-23 in your example), and

1 week ago weekly ema(26, weekly close)

would refer to the value after the close of the Friday before that (so 2/12-16).

• Thanks, Markd. I applied your suggestions and it does appear to have modified the results in a positive direction. Strangely, the specific stock specified (MTCH) is still not captured. I'm aware of it from a prior scan and have been tracking it as it has some characteristics I'm seeking but am concerned that stockcharts scans are erratic and not returning reliable results. I have had similar occurrences in the past and stockcharts has offered little in the way of a solution or reassurance of their product.
• mod
edited February 26
Since you are comparing consecutive weeks (in the first scan), have you tried the PctChange() function?

Also, for PctDiff(), the documentation doesn't explain which term is the divisor. In your case, you want it to be the second, as you have written it. What happens if you reverse the order?