Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Scan for Candlestick Hammer Pattern Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
salisburyz
Posted : Tuesday, October 9, 2007 2:37:22 PM
Registered User
Joined: 10/9/2007
Posts: 1
I'd like to scan for candlestick hammer patterns on daily charts that coincide with a volume spike.  How can I do that?
Bruce_L
Posted : Tuesday, October 9, 2007 2:58:19 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I'm not a candlestick guy. The following is based on the Hammer PCFs in Boolean PCFs for Candlestick Patterns:

Hammer/Dragonfly Doji:

((C < O) * C + (C > O) * O) * ( - 1) - L >= (H - L) * .75 AND H - L > AVGH21 - AVGL21

*Sort in ascending order*

Inverted Hammer/Gravestone Doji:

ABS(C - O) <= (H - L) * .25 AND (C + O) / 2 - L <= (H - L) * .25 AND H - (C + O) / 2 >= (C + O / 2 - L) * .34

*Sort in ascending order*

Adding a Volume Spike condition (in this case, twice the 30-Period SMA of Volume) results in:

Hammer/Dragonfly Doji:

((C < O) * C + (C > O) * O) * ( - 1) - L >= (H - L) * .75 AND H - L > AVGH21 - AVGL21 AND V > 2 * AVGV30.1

*Sort in ascending order*

Inverted Hammer/Gravestone Doji:

ABS(C - O) <= (H - L) * .25 AND (C + O) / 2 - L <= (H - L) * .25 AND H - (C + O) / 2 >= (C + O / 2 - L) * .34 AND V > 2 * AVGV30.1

You should be able to use them as EasyScan Conditions. You may wish to review the following:

How to create a Personal Criteria Forumula (PCF)
Using EasyScan to find stocks that meet your own criteria
Handy PCF example formulas to help you learn the syntax of PCFs!
PCF Formula Descriptions

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Fastmoney
Posted : Thursday, October 11, 2007 11:15:31 AM
Registered User
Joined: 7/14/2005
Posts: 2
Is there a formula for automatic trendline recognition?
Thank You Kindly,
Smith
Bruce_L
Posted : Thursday, October 11, 2007 12:19:05 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Fastmoney,
I'm not sure exactly what you are trying to find. Do you want to identify a specific type of trendline? You may wish to review the following:

Drawing Trendlines, Regressions and Writing Notes on a chart
Spotting trend changes using linear regression channel sorts
Learn to quickly identify when price and volume are in or out of step
Using Linear Regression Sorts to Help Spot Divergences
Learn how to use the forums: post a new topic, reply, Search existing topics

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
AgnosticTrader
Posted : Tuesday, March 4, 2008 2:41:48 AM

Registered User
Joined: 2/1/2008
Posts: 37
QUOTE (Bruce_L)
I'm not a candlestick guy. The following is based on the Hammer PCFs in Boolean PCFs for Candlestick Patterns:

Hammer/Dragonfly Doji:

((C < O) * C + (C > O) * O) * ( - 1) - L >= (H - L) * .75 AND H - L > AVGH21 - AVGL21

*Sort in ascending order*

Inverted Hammer/Gravestone Doji:

ABS(C - O) <= (H - L) * .25 AND (C + O) / 2 - L <= (H - L) * .25 AND H - (C + O) / 2 >= (C + O / 2 - L) * .34



Hi there,

I am trying to covert these formulas to use in Blocks 3.0...

I was able to convert the first one for bullish signals (above) as follows...

QUOTE

If ((price.Close < price.Open) * price.Close + (price.Close > price.Open) * price.Open) * (-1) - price.Low >= (price.High - price.Low) *.75 Then pass


But I am having trouble converting the second formula for Inverted bearish signals...
In particular I am not sure what  "ABS" stands for at the begining of the formula...
Looking for any help I can get here...

Thanks.
Bruce_L
Posted : Tuesday, March 4, 2008 9:02:39 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Mindraider,
I wasn't sure if enclosing a Boolean expression in parentheses would work the same in Blocks' RealCode as it does in TeleChart's Personal Criteria Formula Language, but it seems to be working correctly in the charts I've viewed. I probably would have written the formula you have successfully converted as:

If Price.High > Price.Low And System.Math.Min(Price.Close,Price.Open) - Price.Low >= .75 * (Price.High - Price.Low) Then Pass

The ABS() function returns the Absolute Value (it converts negative values to positive values) of whatever is inside the parentheses. This can be reproduced in RealCode using System.Math.Abs().

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
AgnosticTrader
Posted : Wednesday, March 5, 2008 12:59:08 AM

Registered User
Joined: 2/1/2008
Posts: 37
Thanks Bruce.
Your code looks tighter and so I have used it for the Bullish signals.

I am still having trouble with the bears and the System.Math.Abs function.
QUOTE

If System.Math.Abs(price.Close - price.Open) <= (price.High - price.Low) * .25 And (price.Close + price.Open) / 2 - price.Low <= (price.High - price.Low) * .25 And price.High - (price.Close + price.Open) / 2 >= (price.Close + price.Open / 2 - price.Low) * .34 Then pass


This does not seem to pick up anything. I am in over my head here. Help would be appreciated.
When I use the abs function it prompts for about 7 options, so some clarification that would also help.
Bruce_L
Posted : Wednesday, March 5, 2008 8:55:31 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Mindraider,
I'm not a programmer and really can't explain all of the options available for the System.Math.Abs() function (it is pretty standard VB.NET programming however, so an internet tutorial or reference might be useful in this regard). That said, I don't think it is the reason your formula is not returning any results.

I'm not a candlestick guy, but I think the problem is a missing pair of parentheses when calculating the Body Midpoint near the end of the formula. Please try the following instead:

If System.Math.Abs(Price.Close - Price.Open) <= (Price.High - Price.Low) * .25 And (Price.Close + Price.Open) / 2 - Price.Low <= (Price.High - Price.Low) * .25 And Price.High - (Price.Close + Price.Open) / 2 >= ((Price.Close + Price.Open) / 2 - Price.Low) * .34 Then Pass

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
AgnosticTrader
Posted : Thursday, March 6, 2008 2:11:46 AM

Registered User
Joined: 2/1/2008
Posts: 37
Great stuff. You have been very helpful... Thanks!
Bruce_L
Posted : Thursday, March 6, 2008 8:17:51 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Mindraider,
You're welcome.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
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.