#### Howdy, Stranger!

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

Options

# Candlestick Building Blocks : "Uptrend" and "Downtrend"?

edited March 2015 in Scanning
Hi everybody,
In the blog "Scanning Technically", there is an article called "Candlestick Building Blocks" (http://stockcharts.com/articles/scanning/2011/03/candlestick-building-blocks.html?st=candlestick+building+blocks). This paper presents nine new 'building block' patterns that can be integrated into an advanced scan or a scan standard. I searched the description of two of these 'building block' patterns that are "Uptrend"and "Downtrend" high and low but I have not found anything on the web site, but maybe I looked ill.
Could someone give me the solution for these two 'building block' patterns that are "Uptrend" and "Downtrend"?
Thank you all to help me to see the light!
Joujou

• Options
Yes Joujou & markd, the scan engine does a pretty good job on giving syntax errors. But there are rare cases where it expects to see an expression and it does so no error, however its an expression it can't evaluate so its ignored. That's why its always good to verify your results with chart data.

This one is pretty easy to verify, just scan for a narrow price range to get say 100 stocks.

[type = Stock]
and [country is US]
and [ close > 50 ] and [ close < 52 ]
114 hits

and [EMA (10, close) > EMA (10, [[high + low] / 2])]
still 114 hits this clause is filtering nothing

Try a known formula
and [ close > [high + low] / 2]
50 hits

Now if the math within an EMA is allowed, this should work, EMA-1 is just the current day, thus this should give us 50 hits the same as above.
and [EMA (1, close) > EMA (1, [high + low] / 2)]
Nope back to 114 hits, this clause is filtering nothing.

• Options
mod
edited March 2015
Here's a response from the scan archives:

OK, so, I actually took the step of asking Stockcharts.com what calculation they use, and this was the answer Jack Smith
provided me:
"Our trend definitions are based on the 10-day exponential moving average and the midpoint of the day's data bar. If the
midpoint is above the 10-day EMA, the stock is in an uptrend; if it is below it, the stock is in a downtrend. The definitions are
based on recommendations in Greg Morris's book "Candlestick Charting Explained.""

Here's the link to the whole conversation:

scan.stockcharts.com/discussion/92/uptrend-downtrend-what-is-the-time-frame-for-the-uptrend-and-downtrend-scan-terms-old-s-c-a-n?

• Options
edited March 2015
Thank you for asking this question Joujou. I always had the same question myself on exactly what this means and did not yet post the question to the forum. It's now or never the time to figure it out.

I was hoping that dropping the "Uptrend" or "Downtrend" Candlestick Building Block in the advanced scan engine would reveal it's component calculation. All it shows is this: "and [Uptrend is true]". This clause did not help any with trying to figure it out.

markd: If the "Uptrend" and "Downtrend" are Candlestick Building Blocks, my thinking would be that it would stay at the candlestick level and look at the previous 1-4 period close, high, or low like how gord commented in 2011 from your old scan archive link.

On the surface, it seems strange and hard to believe that a Candlestick Building Block would use chart Moving Average/trend analysis for its calculation.
"...the 10-day EMA, the stock is in an uptrend; if it is below it, the stock is in a downtrend."
The SCC support answer does say "stock" which suggests these two patterns are looking higher than at the Candlestick level.

I do know that Greg Morris has made a major point of knowing what the prior trend is when it comes to pattern analysis. I guess this answer could very well be the case. I am not sure if I am having doubts or if I need to move on.

UPDATE: I guess the reason why I am having any doubt is because the other patterns in this category are at the Candlestick level.
• Options
Quote from Introduction to Candlesticks:
Prior Trend

In his book, Candlestick Charting Explained, Greg Morris notes that for a pattern to qualify as a reversal pattern, there should be a prior trend to reverse. Bullish reversals require a preceding downtrend and bearish reversals require a prior uptrend. The direction of the trend can be determined using trend lines, moving averages, peak/trough analysis or other aspects of technical analysis. A downtrend might exist as long as the security was trading below its down trend line, below its previous reaction high or below a specific moving average. The length and duration will depend on individual preferences. However, because candlesticks are short-term in nature, it is usually best to consider the last 1-4 weeks of price action.
Since the 10 day EMA is 2 weeks, this is in the middle of 1-4 weeks in the above quote from ChartSchool. The above quote could be where these two patterns were defined.

It's not a pattern. It is a building block.
• Options
mod
edited March 2015
Hi Kevo, if you run a scan like [Uptrend is true] and [Maribozu is true] (or any other building block or pattern), and you apply a 10 EMA to the results, you will find the close is in fact always above the 10 EMA. So I think we can believe the support response quoted in the archive.

I think they included an EMA as a "building block", even though it is not strictly a candle pattern or documented in the literature, (e.g. Steve Nison) because they needed a way to define the trend (per Greg Morris' requirement) and because the variety of possible rising or falling candle patterns that might look like an uptrend (or downtrend) is way too large to code (some probably haven't even happened yet). An EMA test is much easier to code, more reliable, and easier for users to verify (although, for this, the terms should be documented more transparently). It is an arbitrary choice (they might have chosen say, a 10 day stochastic above 50) but I think the advantages outweigh the possible disadvantages. And of course you can always use your own definition of trend instead.
• Options
edited March 2015
Thank you markd! I realize you had the same question in 2011. This is an excellent learning experience.
• Options
Thank you to markd and Kevo for your discussion which was very interesting. I regret that Stockcharts not brought itself a more definitive answer to this question and that we have to find the answers.
• Options
The definition can also be found in the "Introduction to Advanced Scanning Tutorial", this document is highly recommended as a prerequisite for anyone interested in learning scanning.

http://stockcharts.com/school/doku.php?id=chart_school:scanning:tutorial

[Uptrend = true]

The Uptrend pattern will find stocks who's current price is above the mid-point of the current daily range and is above the 10 day Exponential Moving Average (EMA). Note that the UpTrend pattern can only be used for prices.
• Options
Hi Gord,
Let us be clear. If I'm right, the following scan reproduces the Uptrend pattern:

// The Candlestick Building Blocks - Uptrend pattern
// Close in upper half of the day's range
[type = stock]
and [close> [[high + low] / 2]]
#and [close > EMA(10,close)] // best is the line below
and [close > EMA(10,[[high + low] / 2])]
• Options
mod
For the second line:

and [close > ema(10,close)]

is enough to meet the definition. The second example (if it works) would be the ema of the mid points of the last 10 days, which is not the same thing as the ema of the closes of the last 10 days (although the scan result might be the same most of the time).

• Options
edited March 2015
I thank you markd.
In fact, now that I think about this second line, if we have a strong uptrend then most of the closing prices will be located towards the top of the range and we should get stocks with EMA (10, close) > EMA (10, [[high + low] / 2]). My comment : "// best is the line below" was wrong.
By the way, these examples work!
• Options
mod
edited April 2015
Hi Joujou, just a note about the scan engine. 99% of the time it does exactly what you expect. But sometimes, it will accept grammatically correct statements but actually do something else. Maybe @gord will weigh in on this, but I seem to remember that you cannot do math within a built-in function like ema(10, [ [high+low]/2]). Maybe I'm wrong or maybe that's changed. In any case, you would want to verify the results with your chart style, which I don't think you can do for an ema of midpoints. But again I could be wrong.
• Options
Thank you Gord for this crystal clear explanation.