Probably one of the easiest ways to determine trend is the use of moving averages. Moving average is simply an average of prices (for example close prices) for a certain number of candles. The shorter the period (fewer candlesticks) to calculate an average the more likely is to be dominated by noise, rather than reflect an underlying trend.

In CandleScanner, there are three basic types of averages: simple, weighted and exponential. The first is the arithmetic average, where each price has the same impact (i.e. equal weight) on the trend value. The other two measures take account the element of time where, essentially, the more distant candle prices have less impact on the calculated trend value and the more recent prices have a greater impact. Consequently, the weighted and exponential averages respond faster to recent price changes than does the simple average.

It is generally the case that the trend is downward if the prices (candlesticks) are below the calculated average line and the trend is upward if they are above it.

Trend is very important in terms of the candle patterns. Every candle pattern is anticipating either a continuation of the current trend or its reversal. There are, essentially, the following types of candle patterns in terms of the price trend:

- bullish reversal patterns – reversing downtrend into an uptrend
- bullish continuation patterns – continuation of uptrend
- bearish reversal patterns – reversing uptrend into downtrend
- bearish continuation patterns – continuation of downtrend

In CandleScanner the user can set the following parameters related to price trend:

- the period (number of candles) of the moving average used as a trend indicator
- the type of average used as a trend indicator
- how long the required trend needs to last in order to consider established candle pattern as valid

All the above parameters have an impact on the number of candle patterns found by CandleScanner.

As an example, **Figure 1** shows how the classification of patterns works according to the trend on the chart. We have three examples of the candle patterns typical for a bear market. To be considered a bearish reversal signal, there should be an existing uptrend to reverse. However, only in the second and third case, with a simple moving average of 10 candles clearly indicating the uptrend, we consider a bearish reversal pattern as valid. In the first case, despite the fact that bearish reversal candle pattern occurred, ultimately it is not recognized as a valid one – the uptrend lasted only for one candle (one day in this case) which is not enough.