BASIC STEPS OF THE ALGORITHM
We are now ready to define the basic steps of an algorithm that can
identify triangular formations in daily charts. In Figure 4 there is a hypothetical daily closing price of an
equity, shown in black. (Refer to this figure for illustrations of the steps of the algorithm.) First, we locate
the last two legs of the zz(20%) indicator. The term bending for the
zigzag indicator means an apex, defined by two swings of this indicator:
STEP 1: Locate the last point of zz(20%) and label it Р“.
Locate the last bending of zz(20%) before Р“ and label it Р’. Locate the last bending of
zz(20%) before Р’ and label it A. In the sequence, we produce a linear regression line of the closing price for the time
period of the last leg Р’Р“ and we produce the Up and Down indicators for this time span:
STEP 2: Generate a linear regression line for the time period that the
leg Р’Р“ lasts and name it reg. Generate the Up and Down indicators of the closing price based on reg for this period. In step 3, we calculate the
percentage of the retracement that took
place during the period of the last leg of zz(20%):
STEP 3: Let CAand CB be the closing prices at points A and B, respectively,
and let РЎ be the indicator of closing prices. Define the height of the formation
as the maximum value of the indicator during Р’Р“. (Note: | x | symbolizes the
absolute value of x.)
FIGURE 4: THE BASIC STEPS OF THE RECOGNITION METHOD. The black contour line is the closing
price of an equity, the green crooked line is the zz(20%) indicator, the cyan line segment is the reg indicator, and
the red contour line is the five-period simple moving average of closing price.
The percent retracement produced by the formation is then defined as:
In step 4, we try to evaluate the small swings (SS) of the market inside
the formation. Since we don't know the
duration of the formation, we shall use the number of crossings of the
five-period simple moving average of the
closing price through the regression line for the time period of Р’Р“: STEP
4: Define the SS number to be the number
of crossings of the five-period simple moving average of closing price
through the regression line during the time
span of Р’Р“.
The first condition a triangular formation must satisfy is the balancing of supply and
demand forces leading the market to an
equilibrium point. This can be mathematically expressed by stating that the slope of the regression line of the
Up indicator is negative and the slope of the
regression line of the Down indicator is positive.
The second condition deals with the time period of the formation. The
time period of a triangular formation
should be at least two weeks (10 trading days) and preferably no more than
three months (60 trading days).
The third condition has to do with the market swings inside the
formation. We demand a minimum of three
crossings of the five-period simple moving average of closing price through the
regression line for the time span of Р’Р“. The
fourth condition deals with the maximum retracement produced by the triangular formation.
As stated at the beginning of this article, we are mainly interested in
triangular formations that occur after
strong trends, so there will be ample room for free upward or downward movement
after the completion of the formation.
I shall allow the triangular formation to produce a maximum retracement of 50%.
STEP 5: The market movement between points Р’ and Р“ is
identified as a triangular formation (TF)
when all of the conditions below are
satisfied:
ў The slope of the linear regression line of the Up indicator is
negative and the slope of the linear
regression line of the Down indicator is positive.
ў The time span between points Р’ and Р“ is
between 10 and 60 trading days.
ў SS
ў %retr>=50
If you want the algorithm to identify longer TFs, you may modify the
second condition accordingly. In
addition, you may change the fourth condition if you want to be aware of TFs
that produce retracements of more than
50%. Using these steps, we can create an algorithm to identify triangular market behavior. Any formation
identified as TF is important.
Category: Daytrading
|