Feb
15

Developing a Scan

Third installment on using pattern scanner.

Most people who think of using scanners do not know what they are doing, period. (Lawrence: I know I am very harsh here, but I do get emotional when I see people doing things to harm their trading accounts unnecessarily.) Throwing in whole bunch of indicators, filtering settings, etc. that you think would yield a list of candidates to monitor in real-time will not help you pick out the winning trades. Even if you do not have a concrete trading plan, you still need to think and research properly with the pattern scanners first. This article shows you the basics in using the pattern scanner to identify market bias for you.

Purpose of a Scan

First understand that a scanner is good for many purposes.

  • Looking for trading opportunities
  • Find out in real-time what is leading the overall market direction
  • Conduct routine data processing on your symbol universe
  • Triggering specialized tasks to be carried out on a timer basis

In this article we will focus on using the scanner for the first purpose only.

Research Approaches

There are 2 ways to approach scanner development – top down and bottom up.

Top Down method focuses on visual inspection of charts, etc. for recurring patterns. Potential criteria for scanning are then translated from the visual patterns into clear concise conditions that can be verified.

For example, many traders use moving averages as a reference series to measure the strength of the price. When the price series touch, bounce, break thru, etc. against the moving average series, the outcome may become more predictable. Scans are then built to match the criteria, and measure the historical outcome like the percentage of days are up or down.

Top Down method works very well if you are an experienced technician and good at reading charts. Your experience translates directly into usable scanning criteria and the research/verification process is just a step to confirm or refute your findings.

Bottom Up method focuses on pre-determined outcome as the initial search criteria, and then examine all known calculations, indicators, etc. to see if a particular set of conditions from these data correlate at a higher percentage with the outcome.

For example, you are interested in finding out what conditions can lead to higher probability of next trading day going up. Scans are built to match the outcome, and then accumulate all combinations of the indicator values, patterns, etc. to see if one or more of these conditions has a higher correlation to occur at the same time with the outcome.

Bottom Up method is usually done by programming teams to systematically discover potential market biases.

Writing a Research Scan

Let’s work on an example scanner using end of day data. If you are not familiar with creating function window or other basic operations, refer to the Help file.

When you are creating a scan for research, the single best tool is simply the fml indicator. It gives you the flexibility to prototype any condition quickly so that you can see how the criteria you specified measure up in historical data.

In this example, I use 4 fml indicators to demonstrate how statistics can be collected easily.

Pattern Setup_20100215_154050

1. Criteria – fml indicator match for the criteria. This can be any formula conditions you wanted to define.

2. Occur% – fml2 indicator linked to the price data and criteria to calculate the percentage of bars that the condition happens.

The formula to accomplish this task is extremely simple,

$total := $total + 1;
$occur := $occur + if (data2 (1) <> 0, 1, 0);
$occur / $total * 100

3. hh% – fml2 indicator linked to the price data and criteria to calculate the percentage of occurence that make a higher high on the next trading day

Again, it is simply summing up the outcome (higher high) we are looking for.

$cond := data2 (1) <> 0;
$occur := $occur + $cond;
$up := $up + if ($cond <> 0 and h > h (1), 1, 0);
$up / $occur * 100

4. up% – fml2 indicator linked to the price data and criteria to calculate the percentage of occurence that make a close higher than the open price on the next trading day

The formula code,

$cond := data2 (1) <> 0;
$occur := $occur + $cond;
$up := $up + if ($cond <> 0 and c > o, 1, 0);
$up / $occur * 100

You can add more statistics easily, just add more indicators to collect outcome information as in the examples above.

Example Criteria

Here is our criteria formula,

l < l (1) and c > c (1)

Classic structural price movement often dictates the price movement in the next lower time frame (higher resolution). The condition above looks for simple daily price bar making a new low for the day, and successfully ending the day with a higher close. That by definition means the particular market rejected the day low and it is likely to test the other extreme on the daily level, namely the day high.

But does it work in real life? Here is the scanning result for S&P 100 over the past 2500 trading days.

Basic Research Scanner_20100215_153156

Out of the 100 components, 95 have more than 60% of the time making a higher high the next day when the condition is met. The condition is very common as well, as it is obvious from the screenshot that the condition happens in more than 10% of trading days across all the symbols.

As a side note, notice that the open to close statistics is pretty much a wash at around 50%. That means, the structural bias only good for the test of the day high, beyond that, it is up to the reaction after the test is done.

Conversion to Production Scan

This particular condition is good enough for further refinement and translation into an end-of-day scan to look for potential daytrading candidates.

As a start, you can copy the scanner and modify the copy to filter for the criteria not equal to 0, and reduces the number of days to load to 10 days.

There you go – one scanner for doing your basic research and your first scanner with functional bias to start with.

Blog Developed
By ContentRobot