2-1-2 pattern
Author: dansmo
Creation Date: 7/23/2010 4:08 AM
profile picture

dansmo

#1
Hi,

I have created an indicator that has integer values:


Uploaded with ImageShack.us

I need to code a pattern that could be described a 2-1-2 pattern.
I have marked it in the picture above.

On the first look the pattern is quite simple, it´s rules are:
1. the indicator is >= +2.
2. the indicator drops to -1.
3. the indicator climbs to >= +2.

However, the indicator can move sideways for indefinite amount of bars. These sideways moves must be ignored.

Example with numbers:
bar - indicator
1 - 5
2 - 5
3 - 5
4 - -1
5 - -1
6 - 1
7 - 1
8 - 1
9 - 3

This should be detected as the described pattern.
My problem is the indefinite length of the pattern. I cannot figure out how to overcome this.
Anyone any ideas?

dansmo
profile picture

dansmo

#2
Okay, I think I´ve made a step in the right direction.
There still seem to be mistakes and the code looks not so beautiful, but I think that´s the way to go:
(brickSumSeries is the indicator series):

CODE:
Please log in to see this code.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).