# Writing Crossover Scans

Scanning for crossovers is a simple concept that all Scan Engine users need to master before moving on to more difficult techniques. In this article, we discuss four useful crossover techniques for you to learn and use in your advanced scans.

## The Price Crossover

A price crossover happens when a stock's price moves from one side of a price overlay line to the other. A great example of this kind of scan signal is when a stock's price moves above its 200-day moving average. Other examples include prices crossing above the upper Bollinger Band or one moving average crossing above a different moving average. The same technique can be used to scan for Parabolic SAR signals too. As with all crossover scans, the key is to realize that the scan actually contains two different conditions. For a crossover to happen, the stock's price must be below the overlay line on one day and above the overlay line on the next day. Breaking that down into statements that the Scan Engine can understand results in something like this:

```[Yesterday's close <= Yesterday's SMA(200,close)]
and [Today's close > Today's SMA(200,close)]```

Because crossover clauses are so common in scans, we've added a special comparison operator that reduces a crossover scan to just one line. Using the “crosses above” operator (“x”), we can also write the above scan like this:

`[close x SMA(200,close)]`

Much simpler, don't you think? In English, you read the above scan as “Today's closing price crosses above today's 200-day simple moving average.”

## The Constant Crossover

A constant crossover happens when an indicator moves above or below a specific level. An example of this kind of crossover would be when the RSI moves above 50, the center line for that indicator. Other examples include an indicator moving above a predefined overbought level or below a predefined oversold level. Again, we can use the “crosses above” operator like this:

`[RSI(14) x 50]`

Read this as “Today's 14-day RSI crosses above 50.”

## The Signal Line Crossover

Many technical indicators come with a second line (usually a short-term moving average of the underlying indicator) that functions as the indicator's “signal line.” A signal line crossover happens when those two lines cross each other, a common example being when the MACD line crosses above its signal line. Other indicators with built-in signal lines include Stochastics, Rate Of Change, On Balance Volume and Accumulation/Distribution. Here's what a signal line crossover scan looks like:

`[MACD Line(12,26,9) x MACD Signal(12,26,9)]`

If the indicator that you are using doesn't come with a built-in signal line, you can use our Advanced Scan Interface to create your own. For instance, here is a signal line crossover scan for the ADX indicator that uses a 7-day simple MA as the signal line:

`[ADX Line(14) x SMA(7, ADX Line(14))]`

## The Cross-Under

We've now seen how to use the “x” operator to create “crosses above”-style scan clauses. But what if we want to scan for situations where one line moves below another line? To create a “crosses below” scan, simply create the equivalent “crosses above” scan and switch the two expressions on either side of the “x” operator.

How does this work? Let's look at a simple example of the 50-day simple moving average crossing below the 20-day simple moving average. At the same time that the 50-day SMA is crossing below the 20-day SMA, the 20-day SMA is crossing above the 50-day SMA, as illustrated in this chart: In this way, you can see that scanning for the 20-day SMA crossing above the 50-day SMA is exactly the same as scanning for the 50-day SMA crossing below the 20-day SMA. Just make sure the expression on the left of the crosses operator is the one that is crossing above and the expression on the right of the crosses operator is the one that is crossing below:

`[SMA(20,close) x SMA(50,close)]`

The same principle can be applied to our earlier examples, changing them from “crosses above” to “crosses below” scan clauses. To find stocks that have moved below their 200-day average, change the price crossover scan we created above into this:

`[SMA(200,close) x close]`

To find stocks whose RSI has just moved below 50, change the constant crossover scan we created above into this:

`[50 x RSI(14)]`

… and so on.

## Conclusions

Using these four crossover scanning techniques will help you create successful crossover scans using the tools on StockCharts.com. Simple and powerful, they can help you find lots of great charts to watch no matter what the market conditions are. 