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.

Angle of moving average scan

Hi,

I want to write a scan that gives me stocks that have their 20 moving average at a sharp angle up, for example let's say return stocks where the 20 moving average on a daily chart is at a 45 degree angle or higher, here is an example of a stock it'd return. Any ideas on how to write a scan to do this?

Thanks for your help!

Comments

  • The angle of the MA depends on the aspect ratio of the chart - that is, its height vs its width. A wider chart will tend to decrease the angle, while a taller chart will tend to increase it.

    The scan engine doesn't know anything about your chart dimensions, so the angle approach isn't going to work too well, I don't think.

    What you could do is add one or two ROC indicators to the chart (temporarily, if it means you have too many indicators), play with the parameters and see what ROC readings correspond to the MA pattern you want.

    ROC is explained here:

    https://school.stockcharts.com/doku.php?id=technical_indicators:rate_of_change_roc_and_momentum

    ROC compares a value today with the same value x days ago and expresses the difference as a per cent.

    You could scan for a value at one point in time, e.g. ROC > 20, or you could scan for ROC increasing - ROC greater than x days ago ROC.

    You could use the ROC of closes (the default), or a ROC of an MA. ROC of the MA will filter out exaggerated price fluctuations.

    The length of the ROC (e.g. 21 days, 50 days, 120 days) will matter. If it's shorter will react faster to price fluctuations, but a high reading may only get you an up leg in a down trend or trading range. A longer ROC will better capture a trend, but it will be later in doing so because it takes longer to lose the data from the prior down leg. That won't matter if you only want to enter after a trend is established, but it will be a problem if you want to get in from the beginning. A shorter term parameter will have the opposite problem - it will get you into a stock early if there is going to be a trend, but it will also get you into a lot of things that turn out to be not in a trend. So its a trade-off you have to work out over time.

    Also consider SCTR rankings. They combine data from different time frames and then rank the results within the SCTR group. So you could scan for say, a SCTR > 70 and SCTR > 1 month ago SCTR (look up the right syntax - or you can select from the scan window drop downs and edit).
Sign In or Register to comment.