InvestorsHub Logo
icon url

alamanjani

07/14/11 8:55 PM

#6848 RE: dudeman135 #6847

Dudeman, pivot should be easy I think, I was doing something similar before will check and if I find I will post pivot part, wouldn't know how to do the first part. But before I try, I need few clarifications


1 - down day - ok

2 - followed by the day that opens lower
{ lower than previous day close or lower than previous day low?}

3 - and closes higher
{again, higher than previous open, or higher than previous high?}
.... if you are talking highs and lows then it is an outside day reversal, correct?

4 - final bar open below previous close (not low, correct?) or equal previous close
icon url

Quasi

08/11/11 8:05 PM

#6854 RE: dudeman135 #6847



Question

"...I'm hoping someone can help me with some criteria for setting up a scan.... I came up with a description in words, but other than item 1 and 2, not sure how to input things into stockcharts.com.

1. Stock must trade over 500,000 shares average for last 20 days
2. Greater than $5
3. Stock must have traded above the 200 DEMA for 20 days or more
4. Stock must be in decline
5. Stock must trade at less than 105% of the 200 DEMA

I define the pivot as the following, using candlesticks:
A down bar, followed by a bar that opens lower and closes higher, and the final bar opens down or equal to the previous bar’s close, and closes higher on the day.

I'm probably asking a lot for the pivot part and I'm cool with eye balling that part if necessary...."

Answer

Great question,
I've been away for a few weeks unplugged, (ie without internet). Back now, currently at the Chartcon conference out in Seattle. The short answer is yes you can scan for all of what you are looking for.

Let’s break it up into sections and review each in a little more detail.

- 1. Stock must trade over 500,000 shares average for last 20 days

and [daily sma(20, daily volume) > 500000]

- 2. Greater than $5

and [Close > 5]

This requires today’s close to be greater than $5, but we could also expand this to require that the average close for the last 20 days be greater than $5.

and [daily sma(20, daily close) > 5]

We could also require the min close for the last 20 days to be greater than $5.

and [Min(20, daily close) > 5]

Or we could require that the min daily low be greater than $5.


and [Min(20, daily low) > 5]


- 3. Stock must have traded above the 200 DEMA for 20 days or more

This one is a little tricky, lets look first at some of the things which won't work.

and [close > ema(20, close)]
This requires only today’s close to be above today’s value of the ema20.

and [min(20,close) > ema(20,close)]
This requires the min close over the last 20 days to be above today’s value of the ema20.

and [min(20,close) > max(20, ema(20,close))]
This requires the min close over the last 20 days to be above the max value over the last 20 days of the ema20, however not necessarily on the same day.

In summary the above criteria are close to what we are looking for but none of them require the close on every individual day to be above the ema20 for that same individual day.

One way to accurately check for a few days is to just write the criteria for each day, as follows.

and [close > ema(20,close)]
and [1 day ago close > 1 day ago ema(20, close)]
and [2 day ago close > 2 day ago ema(20, close)]
and [3 day ago close > 3 day ago ema(20, close)]
etc,
etc,
etc,
and [20 day ago close > 20 day ago ema(20, close)]

While the above method is OK for a few days it can become lengthy for longer time frames and luckily there is another method. We need to start by becoming familiar with the formulas for all the indicators we use on our daily charts. In this case the MACD indicator is of interest, Moving Average Convergence Divergence. The MACD line which is plotted is the raw difference between two exp moving averages, the typical default values are 12, 26. Normally there is also a signal line plotted which is typically a 9 ema of the MACD line.

In our case we are looking at the close being above the 200ema, the trick to remember is that a 1 day ema or sma is actually the closing price for each day. Thus if we plot the Macd 1,200 we are actually plotting the difference between the daily close and the daily value of the ema200 for each individual day. The value is positive when the close is above the ema200 and negative when the close is below the ema200. Thus we only need to scan for the min value to be positive, (greater than 0), for the last 20 days, as follows.

and [Min (20, MACD Line (1,200)) > 0.0]


-4. Stock must be in decline

Lots of ways to this so lets just say in the medium term the 20SMA is below the 50SMA.

and [sma(20, close) < sma(50, close)]



- 5. Stock must trade at less than 105% of the 200 DEMA
Here we simply have to require the close to be less than the ema200 times 1.05

and [Close < ema(200, close)*1.05]

- 6. "I define the pivot as the following, using candlesticks:
A down bar, followed by a bar that opens lower and closes higher, and the final bar opens down or equal to the previous bar’s close, and closes higher on the day".

In this case we just need to look at each day and define the criteria for the open and close each day, note as far as the scan engine is concerned today is day zero "0" and counts back in time. See the following chart which identifies the criteria for each day.




and [2 days ago close < 2 days ago open]
and [1 day ago open < 2 days ago close]
and [1 day ago close > 1 day ago open]
and [open <= 1 day ago close]
and [close > 1 day ago close]



hope this gives you some new scanning ideas

good luck