#### Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Options

Hey guys:
Recently, I am working on the scanning. And I want to trade the break up so I need to find the stocks which is in trading range phase. In my opinion, if SMA10 is moving with SMA30 up and down, that means this stock is in trading range. So the average value of the SMA10 and SMA30 in a period of time such as 20 days should be very close.
So my question is whether there is a way to find the average value of SMA10 and the SMA30 in the past 20 days and compare them? Thank you!

• Options
mod
edited July 2015
Have you looked at MACD or MACD Hist? It uses emas instead of smas, if that's ok. Then look for the Hist bars not to exceed whatever value you think is right. The Hist bars are the differences between the two emas.
• Options
Also, MACD works best in a trading range. The best way to check for a trading range is to look at price in the chart i.e. look for consolidation patterns like Rectangles and Symmetric Triangles.

Small correction... MACD Hist is normally the difference between MACD and a signal line. If you want it to show the difference between the two EMAs, then the third parameter needs to be set to zero.
• Options
mod
@Kevo - thanks for the correction. Sorry, @Heisenberg_lee
• Options
mod
I have to say sorry again because I misremembered @gord 's answers to this kind of question. I don't use MACD or PPO myself so I should have just let someone else answer. Anyway, the code below seems to work. I used Line instead of Hist, and PPO instead of MACD. PPO and MACD are the same, except PPO gives results in percents instead of raw values, so you can compare values across different symbols.

Here it is:

and [max(20, PPO Line(10,30,0)) < 1]
and [min(20, PPO Line(10,30,0)) > -1]

You can play with plus 1 and minus 1, but they seem to work pretty well and picking up ranging behavior.
• Options
That is a nice looking scan you have there @markd ; very thoughtful. It looks like it answers @Heisenberg_lee 's question. Someone else answer? No I don't think so. For example, I would never have thought of a scan like this.

I think we complement each other well. You are the scanning expert and I try to find expertise in other things.

I remember you said you do not use MACD. I learned a lot of details about MACD in this post: http://scan.stockcharts.com/discussion/503/moving-average-of-a-moving-average
• Options
mod
edited July 2015
@Kevo, thanks for the compliment about the complement, and thanks for the tip.

I know people love MACD and use it successfully. But after playing around with dozens of indicators I realized my thinking is really oriented toward volume and support/resistance. So, I settled on volume based indicators, channels and stochastics in various time frames. They seem to me to be more timely - or at least it's easier for me to read them. At some point, you have to say enough is enough and decide what you are going to concentrate on to the point that it is second nature. So that's what I've done. Not a criticism of folks who have chosen differently, just a difference in style.
• Options
Thanks guys, @Kevo @markd that is really helpful for me.