Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Boolean PCFs for Candlestick Patterns Topic Rating:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Craig_S
Posted : Thursday, October 6, 2005 11:59:56 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819

This post is presented as an alternative method for finding candles presented here:

PCFs and EasyScans for Candlestick Patterns

Each PCF is one Boolean formula and self-contained. You will want to sort the results of your EasyScans by a price performance criterion to be sure the stock is trending the right way (if the pattern requires a trend).

Each pattern has one PCF. If you add that pattern’s PCF to an EasyScan you will limit the stocks to those that meet the requirements.

You can visually back test these patterns using the PCF for the pattern in the procedure taught in this video:

Visually Backtesting Specific Symbols

****************  Basic Patterns  *******************

C < O
 
H > O AND C = L AND O - C > 3 * AVG(ABS(O - C), 15) / 2
 
H - L = O - C AND O - C > 3 * AVG(ABS(O - C), 15) / 2
 
H = O AND C > L AND O - C > 3 * AVG(ABS(O - C), 15) / 2
 
(L = C OR C = H) AND H - L > ABS(O - C) AND ABS(O - C) > 3 * AVG(ABS(O - C), 15) / 2
 
20 * ABS(O - C) <= H - L
 
ABS(O - C) > 3 * AVG(ABS(O - C), 15) / 2
 
O - C > 3 * AVG(ABS(O - C), 15) / 2
 
C - O > 3 * AVG(ABS(O - C), 15) / 2
 
H - L = ABS(O - C) AND H - L > 3 * AVG(ABS(O - C), 15) / 2
 
(L = O OR O = H) AND H - L > ABS(O - C) AND ABS(O - C) > 3 * AVG(ABS(O - C), 15) / 2
 
ABS(O - C) < AVG(ABS(O - C), 15) / 2
 
C < O AND O - C < AVG(ABS(O - C), 15) / 2
 
O < C AND C - O < AVG(ABS(O - C), 15) / 2
 
O = C
 
O < C
 
H = C AND O > L AND C - O > 3 * AVG(ABS(O - C), 15) / 2
 
H - L = C - O AND C - O > 3 * AVG(ABS(O - C), 15) / 2
 
H > C AND O = L AND C - O > 3 * AVG(ABS(O - C), 15) / 2

 

****************  Bullish Patterns  *******************

Abandoned Baby
(O2-C2)>=.7*(H2-L2) AND (H2-L2)>=(AVGH10.2-AVGL10.2) AND (H1<L2) AND ABS(C1-O1)<=.05*(H1-L1) AND  (H-L)>=(AVGH10-AVGL10) AND (C-O)>=.7*(H-L) AND (L>H1)
 

Belt Hold
(O=MINO10) AND (O<L1) AND (C-O)>=.7*(H-L) AND (H-L)>=1.2*(AVGH10-AVGL10) AND (O-L)<=.01*(H-L) AND (C<=H1-.5*(H1-L1)) AND (H1>L1) AND (H>L) AND (C1<C2) AND (C2<C3)
 

Breakaway
C4 < O4 AND ABS(C4 - O4) > .5 * (H4 - L4) AND C3 < O3 AND H3 < L4 AND C2 < C3 AND C1 < C2 AND ABS(C - O) > .6 * (H - L) AND C > O AND C > H3
 

Concealing Baby Swallow
O3 = H3 AND C3 = L3 AND O2 = H2 AND C2 = L2 AND C1 < O1 AND O1 < C2 AND H1 > C2 AND O = H AND C = L AND H > H1 AND L < L1
 

Doji (Dragonfly):
ABS(O-C)<=.02*(H-L) AND (H-C)<=.3*(H-L) AND (H-L)>=(AVGH10-AVGL10) AND (H>L) AND (L=MINL10)

Doji (Gravestone):
ABS(O-C)<=.01*(H-L) AND (H-C)>=.95*(H-L) AND (H>L) AND (L<=L1+.3*(H1-L1)) AND (H-L)>=(AVGH10-AVGL10)

Doji Star (aka Unconfirmed Bullish Morning Doji Star)
(O1-C1)>=.7*(H1-L1) AND (H1-L1)>=(AVGH10.1-AVGL10.1) AND (C<C1) AND (O<C1) AND ABS(C-O)<=.05*(H-L) AND (L=MINL10) AND (H1>L1) AND (H>L)
 

Engulfing
(O1>C1) AND (C-O)>=.7*(H-L) AND (C>O1) AND (O<C1) AND (H-L)>=1.2*(AVGH10-AVGL10)
 

Hammer/Dragonfly Doji
ABS(C-O)<=.2*(H-L) AND ABS(O-C)>=.1*(H-L) AND (O-L)>=.5*(H-L) AND (C-L)>=.5*(H-L) AND (H-O)<=.05*(H-L) OR (H-C)<=.05*(H-L) AND (H-L)>=.8*(AVGH10-AVGL10) AND (L=MINL5) AND (H>L)
 

Harami
(O1-C1)>=.7*(H1-L1) AND (H1-L1)>=(AVGH10.1-AVGL10.1) AND (C>O) AND (O>C1) AND (C<O1) AND (C-O)<=.6*(O1-C1)
 

Harami Cross
ABS(C1 - O1) > .5 * (H1 - L1) AND C1 < O1 AND H < O1 AND L > C1 AND (C + O) / 2 - L > .4 * (H - L) AND (C + O) / 2 - L < .6 * (H - L) AND ABS(C - O) < .2 * (H - L)
 

Homing Pigeon
C1 < O1 AND ABS(C - O) >= .6 * (H1 - L1) AND ABS(C1 - O1) >.5 * (H1 - L1) AND H < O1 AND L > C1 AND C < O
 

Inverted Hammer
ABS(O-C)<=.2*(H-L) AND ABS(O-C)>=.1*(H-L) AND (H-O)>=.5*(H-L) AND (H-C)>=.5*(H-L) AND (O-L)<=.05*(H-L) OR (C-L)<=.05*(H-L) AND (H-L)>=.8*(AVGH10-AVGL10) AND (O<=(H1-.5*(H1-L1))) AND (C<=(H1-.5*(H1-L1))) AND (L=MINL5) AND (H>L)
 

Kicking
O3 - C3 > .6 * (H3 - L3) AND O2 - C2 > .6 * (H2 - L2) AND O1 - C1 > .6 * (H1 - L1) AND C3 < O3 AND C2 < O2 AND C1 < O1 AND C > O AND O2 < C3 AND O1 < C2 AND O > O1 AND C - O > .6 * (H - L)

Ladder Bottom
O4 > C4 AND O3 < O4 AND C3 < C4 AND O2 < O3 AND C2 < C3 AND C1 < O1 AND H1 > O1 AND C > O AND O > O1
 

Mat Hold
C4 > O4 AND ABS(C4 - O4) > .5 * (H4 - L4) AND C3 < H4 AND C2 < H4 AND C1 < H4 AND C3 > L4 AND C2 > L4 AND C1 > L4 AND C > C4 AND C > O AND H - L > AVGH21 - AVGL21 AND C2 < C3 AND C1 < C2 AND ABS(C3 - O3) <= .75 * ABS(C4 - O4) AND ABS(C2 - O2) <= .75 * ABS(C4 - O4) AND ABS(C2 - O2) <= .75 * ABS(C4 - O4)
 

Matching Low
C1 < O1 AND ABS(C1 - O1) > .5 * (H1 - L1) AND C < O AND ABS(C / C1 -1) < .01
 

Meeting Lines
C1 < O1 AND H1 - L1 > AVGH21.1 - AVGL21.1 AND O1 < MINL3.3 AND C > O AND ABS(C / C1 - 1) < .01
 

Morning Doji Star (Bullish Morning Star Variant)
(O2-C2)>=.7*(H2-L2) AND (H2-L2)>=(AVGH10.2-AVGL10.2) AND (C1<C2) AND (O1<C2) AND ABS(C1-O1)<=.05*(H1-L1) AND (H-L)>=(AVGH10-AVGL10) AND (C-O)>=.7*(H-L) AND (O>C1) AND (O>O1)
 

Morning Star
O2 > C2 AND O2 - C2 > .6 * (H2 - L2) AND C2 > O1 AND ABS(O1 - C1) < .5 * ABS(O2 - C2) AND H1 - L1 > 3 * (C1 - O1) AND C > O AND O > O1 AND O > C1

One White Soldier
C1 < O AND O < O1 AND O1 < C AND C1 < C2 AND C2 < C3 AND C3 < C4

Piercing Line
(O1>C1) AND (H1-L1)>=(AVGH10.1-AVGL10.1) AND (O<C1) AND C > C1+.5*(O1-C1) AND (C<O1)
 

Rising Three Method:
(C4-O4)>=.7*(H4-L4) AND (H4-L4)>=(AVGH20-AVGL20) AND (H4=MAXH10.4) AND (C3<C4) AND (C3>=O4+.5*(H4-L4)) AND (O2<O3) AND (C2<O3) AND (O2<C3) OR (C2<C3) AND (O1<O2) OR (O1<C2) AND (C1<O2) AND (C1<C2) AND (C1>O4) AND (O>O4) AND O<=L4+.6*(H4-L4) AND (C>C4)
 

Separating Lines
C1 < O1 AND C > O AND ABS(O / O1 - 1) < .01
 

Side by Side White Lines
C2 > O2 AND C1 > O1 AND L1 > H2 AND ABS(C / C1 - 1) < .1 AND ABS(ABS(C - O) / ABS(C1 - O1) - 1) < .15
 

Stick Sandwich
C2 < O2 AND C1 > O1 AND L1 > C2 AND C < O AND ABS(C / C2 - 1) < .02
 

Three Inside Up (aka Confirmed Bullish Harami)
(O2-C2)>=.7*(H2-L2) AND (H2-L2)>=(AVGH10.2-AVGL10.2) AND (C1>O1) AND (O1>C2) AND (C1<O2) AND (C1-O1)<=.6*(O2-C2) AND (O>O1) AND (O<C1) AND (C>C1) AND (C-O)>=.7*(H-L)
 

Three Line Strike
C2 > C3 AND C1 > C2 AND H3 - L3 > AVGH21.3 - AVGL21.3 AND H2 - L2 > AVGH21.2 - AVGL21.2 AND H1 - L1 > AVGH21.1 - AVGL21.1 AND O > O3 AND C < O3
 

Three Outside Up (aka Confirmed Bullish Engulfing)
(O2>C2) AND (C1-O1)>=.7*(H1-L1) AND (C1>O2) AND (O1<C2) AND (H1-L1)>=1.2*(AVGH10.1-AVGL10.1) AND (O>O1) AND (O<C1) AND (C>C1) AND (C-O)>=.7*(H-L)
 

Three Stars in the South
L2 < L1 AND L1 <= L AND L = C AND (C < O OR L = H) AND O = H AND H <= H1 AND C1 < O1 AND O1 - C1 < O2 - C2 AND H1 - L1 < H2 - L2 AND L2 < C2 AND C2 < O2 AND O2 = H2 AND FAVGC10 < AVGC10 AND C < C9

Three White Soldiers
C > C1 AND C1 > C2 AND C > O AND C1 > O1 AND C2 > O2 AND ABS(C2 - O2) > .5 * (H2 - L2) AND ABS(C1 - O1) > .5 * (H1 - L1) AND H - L > AVGH21 - AVGL21 AND O > O1 AND O < C1 AND O1 > O2 AND O1 < C2 AND O2 > O3 AND O2 < C3 AND C > .85 * H AND C1 > .85 * H1 AND C2 > .85 * H2
 

Tri Star
ABS(C - O) <= .05 * (H - L) AND (C + O) / 2 - L >= .4 * (H - L) AND (C + O) / 2 - L <= .6 * (H - L) AND ABS(C1 - O1) <= .05 * (H1 - L1) AND (C1 + O1) / 2 - L1 >= .4 * (H1 - L1) AND (C1 + O1) / 2 - L1 <= .6 * (H1 - L1) AND ABS(C2  -O2) <= .05 * (H2 - L2) AND (C2 + O2) / 2 - L2 >= .4 * (H2 - L2) AND (C2 + O2) / 2 -L2 <= .6 * (H2 - L2) AND H1 < L3 AND H1 < L1
 

Tweezer Bottom
L = L1 AND ABS(C - O) < .2 * ABS(C1 - O1) AND ABS(C1 - O1) >= .9 * (H1 - L1) AND H1 - L1 >= 1.3 * (AVGH20 - AVGL20)
 

Unique Three River Bottom
ABS(C2 - O2) >= .7 * (H2 - L2) AND ABS(C2 - O2) > .5 * (H2 - L2) AND C1 < O1 AND O1 < O2 AND C1 > C2 AND L1 = MINL5.1 AND C > O AND C < C1
 

Upside Gap Three Methods
ABS(C2 - O2) > .5 * (H2 - L2) AND ABS(C1 - O1) > .5 * (H1 - L1) AND L1 > H2 AND C < C2 AND O > O1
 

Upside Tasuki Gap
ABS(C2 - O2) > .5 * (H2 - L2) AND ABS(C1 - O1) > .5 * (H1 - L1) AND L1 > H2 AND C < O AND C < O1 AND C > C2
 

****************  Bearish Patterns  ***********************

Abandoned Baby
ABS(C2 - O2) > .5 * (H2 - L2) AND C2 > O2 AND ABS(C1 - O1) <= .05 * (H1 - L1) AND (C1 + O1) / 2 - L1 >= .4 * (H1 - L1) AND (C1 + O1) / 2 - L1 <= .6 * (H1 - L1) AND L1 > H2 AND C < O AND H < L1 AND O > C2 AND (L > O2 OR C < L2)
 

Advance Block
H - L > AVGH21 - AVGL21 AND ABS(C1 - O1) > .5 * (H1 - L1) AND ABS(C2 - O2) > .5 * (H2 - L2) AND C > C1 AND C1 > C2 AND O1 > O2 AND O1 < C2 AND O > O1 AND O < C1 AND H - L < .8 * (H1 - L1) AND H1 - L1 < .8 * (H2 - L2) AND H - C > O - L AND H1 - C1 > O1 - L1
 

Belt Hold
(O=MAXO10) AND (O>H1) AND (O-C)>=.7*(H-L) AND (H-L)>=1.2*(AVGH10-AVGL10) AND (H-O)<=.01*(H-L) AND (C>=H1-.5*(H1-L1)) AND (H1>L1) AND (H>L) AND (C1>C2) AND (C2<C3)
 

Breakaway
ABS(C4 - O4) > .5 * (H4 - L4) AND C4 > O4 AND C3 > O3 AND L3 > H4 AND C2 > C3 AND C1 > C2 AND C < O AND L < H4 AND H > L3
 

Dark Cloud Cover
(C1-O1)>=.7*(H1-L1) AND (H1-L1)>=(AVGH10.1-AVGL10.1) AND (O>C1) AND C<C1-.5*(C1-O1) AND (C>O1)
 

Deliberation
ABS(C2-O2) > .5 * (H2 - L2) AND ABS(C1 - O1) > .5 * (H1 - L1) AND C1 > C2 AND C2 > O2 AND C1 > O1 AND O > H1 AND (C + O) / 2 - L > .4 * (H - L) AND (C + O) / 2 - L < .6 * (H - L) AND ABS(C - O) < .6 * (H - L)
 

Downside Gap Three Methods
ABS(C2-O2) > .5 * (H2 - L2) AND ABS(C1 - O1) > .5 * (H1 - L1) AND C2 < O2 AND C1 < O1 AND H1 < L2 AND L < H1 AND H > L2 AND C > O
 

Downside Tasuki Gap
C2 < O2 AND C1 < O1 AND H1 < L2 AND O > C1 AND O < O1 AND C > H1 AND C < L2
 

Doji Star
ABS(C1 - O1) > .5 * (H1 - L1) AND O > C1 AND ABS(C - O) < .05 * (H - L) AND H - L < .2 * (AVGH21 - AVGL21)
 

Doji (Gravestone)
ABS(O-C)<=.01*(H-L) AND (H-C)>=.95*(H-L) AND (H>L) AND (H=MAXH10) AND (H-L)>=(AVGH10-AVGL10)

Dragonfly Doji/Hanging Man
ABS(O-C)<=.02*(H-L) AND (H-C)<=.3*(H-L) AND (H-L)>=(AVGH10-AVGL10) AND (H>L) AND (H=MAXH10)
 

Engulfing
(C1>O1) AND (O-C)>=.7*(H-L) AND (C<O1) AND (O>C1) AND (H-L)>=1.2*(AVGH10-AVGL10)
 

Evening Doji Star
ABS(C2 - O2) > .5 * (H - L) AND C2 > O2 AND ABS(C1 - O1) < .05 * (H1 - L1) AND H1 - L1 < .2 * (AVGH21.1 - AVGL21.1) AND O1 > C2 AND C < O
 

Evening Star
(C2-O2)>=.7*(H2-L2) AND (H2-L2)>=(AVGH10.2-AVGL10.2) AND (C1>C2) AND (O1>C2) AND (H-L)>=(AVGH10-AVGL10) AND (O-C)>=.7*(H-L) AND (O<O1) AND (O<C1)
 

Falling Three Methods
ABS(C4 - O4) > .5 * (H4 - L4) AND C4 < O4 AND ABS(C3 - O3) < ABS(C4 - O4) AND ABS(C2 - O2) < ABS(C4 - O4) AND ABS(C1 - O1) < ABS(C4 - O4) AND L3 >= L4 AND H3 <= H4 AND L2 >= L4 AND H2 <= H4 AND L1 >= L4 AND H1 <= H4 AND H2 > H3 AND H1 > H2 AND C < O AND C < C4
 

Grave Stone Doji/Shooting Star
ABS(C - O) < (H - L) / 3 AND O > C1 AND (C + O) / 2 - L < .4 * (H - L) AND H = MAXH10
 

Hanging Man
ABS(C >= O) * O + ABS(C < O) * C - L >= 2 * ABS(C - O) AND (C + O) / 2 - L > 2 * (H - (C + O) / 2) AND ABS(C - O) > .01
 

Harami (Bearish Harami Variant)
(C1-O1)>=.7*(H1-L1) AND (H1-L1)>=(AVGH10.1-AVGL10.1) AND (C<O) AND (O<C1) AND (C>O1) AND (O-C)<=.6*(C1-O1)
 

Harami Cross
ABS(C1 - O1) > .5 * (H - L) AND C1 > O1 AND H < C1 AND L > O1 AND ABS(C - O) < .2 * (H - L)
 

Identical Three Crows
C2 < O2 AND C1 < O1 AND C < O AND C < L1 AND C1 < L2 AND O = C1 AND O1 = C2
 

In Neck
ABS(C1 - O1) >.5 * (H1 - L1) AND C1 < O1 AND O < L1 AND C >= C1 AND C < 1.05 * C1
 

Kicking
C = L AND O = H AND H > L AND H < L1 AND C1 = H1 AND O1 = L1 AND H1 > L1
 

Meeting Lines
ABS(C1 - O1) > .5 * (H1 - L1) AND C1 > O1 AND (C1 + O1) / 2 > H2 AND ABS(C - O) > .5 * (H - L) AND C < O AND (C + O) / 2 > H1 AND C = C1
 

On Neck
ABS(C1 - O1) > .5 * (H1 - L1) AND C1 < O1 AND O < L1 AND C = L1

One Black Crow
C < O1 AND O1 < C1 AND O < C1 AND C4 < C3 AND C3 < C2 AND C2 < C1

Separating Lines
C1 > O1 AND C < O AND O = O1
 

Shooting Star
ABS(O-C)<=.2*(H-L) AND ABS(O-C)>=.1*(H-L) AND (H-O)>=.5*(H-L) AND (H-C)>=.5*(H-L) AND (O-L)<=.05*(H-L) OR (C-L)<=.05*(H-L) AND (H-L)>=.8*(AVGH10-AVGL10) AND (O>=(L1+.5*(H1-L1))) AND (C>=(L1+.5*(H1-L1))) AND (H=MAXH5) AND (H>L)

Side-by-side White Lines
C2 < O2 AND H1 < L2 AND C1 > O1 AND ABS(C1 - O1) > .95 * ABS(C - O) AND ABS(C1 - O1) < 1.95 * ABS(C - O) AND C > O AND C = C1
 

Three Black Crows
O1 < O2 AND O1 > C2 AND O < O1 AND O > C1 AND C1 < L2 AND C < L1 AND C2 < 1.05 * L2 AND C1 < 1.05 * L1 AND C < 1.05 * L
 

Three Inside Down
ABS(C2 - O2) > .5 * (H1 - L1) AND C2 > O2 AND C1 < O1 AND H1 < C2 AND L1 > O2 AND C < O AND C < C1
 

Three Line Strike
C3 < O3 AND C2 < O2 AND C2 < C3 AND C1 < O1 AND C1 < C2 AND O < C1 AND C > O3
 

Three Outside Down (aka Confirmed Bearish Engulfing)
(C2>O2) AND (O1-C1)>=.7*(H1-L1) AND (C1<O2) AND (O1>C2) AND (H1-L1)>=1.2*(AVGH10.1-AVGL10.1) AND (O<O1) AND (O>C1) AND (C<C1) AND (O-C)>=.7*(H-L)
 

Thrusting
ABS(C1 - O1) > .5 * (H1 - L1) AND C1 < O1 AND O < L1 AND C > C1 AND C < (C1 + O1) / 2

Tri Star
ABS(C - O) < .05 * (H - L) AND H - L < .2 * (AVGH21 - AVGL21) AND ABS(C1 - O1) < .05 * (H1 - L1) AND H1 - L < .2 * (AVGH21.1-AVGL21.1) AND ABS(C2 - O2) < .05 * (H2 - L2) AND H2 - L2 < .2 * (AVGH21.2 - AVGL21.2) AND L2 > H1 AND L2 > H
 

Tweezer Top
H = H1 AND ABS(C - O) < .2 * ABS(C1 - O1) AND ABS(C1 - O1) >= .9 * (H1 - L1) AND H1 - L1 >= 1.3 * (AVGH20 - AVGL20)
 

Two Crows
ABS(C2 - O2) > .5 * (H2 - L2) AND C2 > O2 AND L1 > H2 AND C1 < O1 AND O > C1 AND O < O1 AND C < C2 AND C > O2
 

Upside Gap Two Crows
ABS(C2 - O2) > .5 * (H2 - L2) AND C2 > O2 AND L1 > H2 AND C1 < O1 AND O > O1 AND C < C1 AND C > H2
 



- Craig
Here to Help!
jlawson2800
Posted : Friday, September 19, 2014 11:51:58 PM
Registered User
Joined: 10/7/2011
Posts: 1
Craig,How can we put maybe the bullish candle patterns as one indicator and the Bearish Candles one indicator?Also how can a formula be written that will lable the candle when it pops up on the chart when it is identified by the indicator?You seem very knowledgeable about candlestick patterns and formulas for them.Eager to hear your response.
StockGuy
Posted : Monday, September 22, 2014 11:04:39 AM

Administration

Joined: 9/30/2004
Posts: 9,187

You could OR all of the formulas together to make it one big formula, but it might be hard to figure out which pattern resulted in the True indication.

We don't have way to create formula-based chart labels.

Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.