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 for when the monthly hits the SMA 20

edited April 2021 in Scanning
Hi there,

How would i be able to scan if the monthly price hits the monthly SMA 20? I've tried this: and [monthly low < monthly sma(20)] - this works for one particular day but is there a way to find any stock thats hit the SMA (20) across the whole month with just one scan? I'm thinking a min or max function would work but i also want the stock to have hit the monthly upper bollinger band previously which is why i have this in my current scan:

and
[
[3 months ago high > 3 months ago upper BB(20,2)]

or

[4 months ago high > 4 months ago upper BB(20,2)]

or

[5 months ago high > 5 months ago upper BB(20,2)]
]


(Thanks in advance!)


Here's an example, i can't seem to find this monthly low even when i put it exactly on the day that the low occurred:

Comments

  • I think you want to test for this month's high > sma, and this month's low < sma. That should work the first day of the month where the condition becomes true and every day of that month thereafter.

    If you want it to be the first month in which this occurs, you could test for an "or" condition for the previous month - last month's low > last month's sma OR last month's high < last month's sma.

Sign In or Register to comment.