# backtesting the behavior BEFORE a price pattern occurs

#### fatowl

##### Junior member
33 0
Hey guys and gals. I just had an interesting idea that sounds like something most mechanical system designers/traders have not done.

Let's say you identify a certain price pattern or indicator pattern. Name it "Price Pattern A". Plenty of backtesters would try to get a histogram of closing prices for 1, 2, 3,... days after Price Pattern A. However, wouldn't it be interesting to get a histogram of closing prices for 1, 2, 3,... days before Price Pattern A?

For instance, what if we found that any one of these were true:

1. 90% of the time, Price Pattern B preceded Price Pattern A within 10 days.
2. 5% of the time, Price Pattern C preceded Price Pattern A within 10 days.
3. Price Pattern D never preceded Price Pattern A within 10 days.

This could give you somewhat of an edge. Say for instance, during your trading, you noticed that either Price Pattern C or Price Pattern D occured. You could be extremely confident that Price Pattern A will not occur in the near future.

I am perplexed at Price Pattern B though. Let's say that Price Pattern B occured. Then, you could lookout for Price Pattern A, but you cannot say there is a 90% chance of it occurring. The reason is causality. The presence of A implies that B occured in the past 10 days with a 30% chance. However, does B cause A? You would have to run a separate backtest on that. It is possible that B causes A 1% of the time or 100% of the time. Think about it this way: every car crash involves a car (this is 100% certain), but only a small percentage of cars get into a crash. Here, the car crash represents Price Pattern A, and the presence of a car represents Price Pattern B.

I'm spinning myself in loops here. Just wanted to see if anyone has seen some research or tried this themselves. I feel like there might be an academic paper on it in quantitative finance.

#### trendie

##### Legendary member
6,878 1,431
a car crash only has a 100% certainty of involving a car because you know retrospectively it involved a car.

if you used analogy of Price as crash, price pattern A could be a car crash, pattern B a plane crash, etc.

you have an interesting thought going on there.
but how is this different from the statistical odds of a part-formed Shoulder and Head pattern resulting a fulfilled or failed Head and Shoulders pattern.
Or the odds of a 1-2-3 reversal, or support or resistance holding or failing.

At least the partly-formed pattern of a 1-2-3 or Sup/Res has internal logic, whereas the proximity of PatternA to Pattern B seems arbitrary.

Do you have any examples to illustrate this idea of yours.
I think it may be worth a shot as an experiment.

#### fatowl

##### Junior member
33 0
a car crash only has a 100% certainty of involving a car because you know retrospectively it involved a car.

Maybe it's a bad example. If you backtested car crashes, you might find that 25% involved drunk drivers. However, this doesn't tell you what percentage of people who are currently driving drunk right now will be in a car crash.

Do you have any examples to illustrate this idea of yours.
I think it may be worth a shot as an experiment.

I attached a very simple example.

Price Pattern A: a 20-point drop in the RSI(3) indicator.
Price Pattern B: RSI(3) indicator is greater than 70 for at least 2 days.

You can see that B happens before A only two times out of four. This does not mean that B causes A 50% of the time. All it means is that given the presence of A, B will have happened 50% of the time.

Obviously, we can't use this type of backtest to create trading signals. Just because B happens does not mean A will happen with any regularity. A separate backtest that measures how many times B causes A will yield trading signals/probabilities.

The question is: is there any worth to doing this type of non-causal backtest? Can it affect money management or position sizing?

#### Attachments

• EXC price pattern A and B.png
45.5 KB · Views: 276
Last edited:

#### kenlionheart

##### Newbie
1 0
I would say this could be extremely useful.
This would be a very clever way to create or improve trading strategies/systems.

For example, if I have a successful automated system which is profitable 60% of the time, using this idea, I would study the 40% losing trades and see what they have in common between them that is absent in the winning trades.

This can lead to finding something which can help to filter out losing trades and thereby refining the system to increase profitable trades to 70% for example.

Look at CAN SLIM. This idea is similar to O'Neil did.

Do you know of any software on which this kind of back testing can be done?

#### numbertea

##### Well-known member
257 9
A couple of weeks ago I started reidentifying the reversal patterns that I code into my trading program. Previously I would just identify short uptrends or downtrends before the pattern is seen. I now include bar specifics before the pattern hits for my pattern algorithms. I have increased good hit probability and kept the entry/exit timing in the process. I would say it is a great way to increase pattern validity.

Works for me.

Cheers

Replies
0
Views
974
Replies
7
Views
3K
Replies
0
Views
554
Replies
3
Views
2K
Replies
0
Views
1K