Candle Pattern Coding Formulas

atcsam

New member
Just wondering if there is a holy grail for coding/ defining/ formulas for Candlesticks and patterns...

I'll set TOS as a reference, seem OK but perhaps not the best.

I have not done a full comparison yet, thought I'd question the experts...

Found a detailed list on TC2000 with formulas.

Samples of code some Trade View are using...

Appears to be some subjectivity in describing things "pretty short wick", "slightly more than" "slightly less than", "Close to" etc. maybe an occasional "if /then/ else/ BUT what if......"

Here is an example of what I'm seeing (not complete codes) for the "Hammer" looking for Best Practice...
Even the descriptions I've read are vague at times.


Source: TOS ( averages 20 candles)
def BodyHeight = BodyHeight();
def AverageBodyHeight = Average(BodyHeight, length);
def ErrMargin = 0.05 * AverageBodyHeight;
def IsShort = BodyHeight < bodyFactor * AverageBodyHeight;

Source 1: Averages 10
5 * ABS(C - O) <= H - L AND 10 * ABS(O - C) >= H - L AND 2 * O >= H + L AND STOC1 >= 50 AND (20 * O >= 19 * H + L OR STOC1 >= 95) AND 10 * (H - L) >= 8 * (AVGH10 - AVGL10) AND L = MINL5 AND H > L

Source 2: Plain and simple...
(((H-L)>3*(O-C)AND((C-L)/(.001+H-L)>0.6)AND((O-L)/(.001+H-L)>0.6)))

Source 3: averages 20
if( wick > ( body*2.0 ) && tip < (body/2) ){ BufferBullishHammer = Low - 20*Point;

Source 4: Close above or below 52 ma
def MovingAvg = 52;
def Avg2 = SimpleMovingAvg(close, MovingAvg);
def CandleBody = AbsValue(open - close);
def UpperWick = high - Max(open, close);
def LowerWick = Min(open, close) – low;
def Hammer = LowerWick > CandleBody * 2 and UpperWick <= LowerWick * 0.2 and low < low[1] and low < low[2] and low < low[3] and low < low[4] and low < low[5] and low < low[6] and low < low[7] and low < low[8] and close > Avg;


Source 5: No averages but plots on a 20 day pivot
def hammer = pl and min(open,close) - low> d and high - max(close,open) < d;

######################################
The list goes on....
Tweezers... well... I'm just going to code that one.
Exact Tweezers, Close enough Tweezers and Fuzzy tweezers... and not necessarily together.
 
Solution
Here is an example of what I'm seeing (not complete codes) for the "Hammer" looking for Best Practice...
Even the descriptions I've read are vague at times.
You seem to be confusing candle patterns with strategies that USE candle patterns.

Candle patterns in of themselves are identification of the candles themselves. Yes, you then can combine them with any trend/momentum strategy

For the code to identify the candle patterns:
https://tlc.thinkorswim.com/center/howToTos/thinkManual/charts/Patterns/Candlestick-Pattern-Editor#:~:text=What's a candlestick pattern?
Here is an example of what I'm seeing (not complete codes) for the "Hammer" looking for Best Practice...
Even the descriptions I've read are vague at times.
You seem to be confusing candle patterns with strategies that USE candle patterns.

Candle patterns in of themselves are identification of the candles themselves. Yes, you then can combine them with any trend/momentum strategy

For the code to identify the candle patterns:
https://tlc.thinkorswim.com/center/howToTos/thinkManual/charts/Patterns/Candlestick-Pattern-Editor#:~:text=What's a candlestick pattern?
 
Solution
Probably overthinking this...
Using Hammer as an example where the tail is 2x the body (is that ABS 10 candle average 20?) Seems 20 candles is the norm.
Define Little or No Upper Wick; as a percentage of body height (abs Average , < 1%,10% or 25%.
wasn't sure if there was a preferred standard.

Developing a study / strategy implementing concepts from "The Candlestick Trading Bible" sanyog raut, and Steve Nison's "Japanese Candlestick Charting Techniques"

So far the study dynamically identifies key Candles, support resistance levels (intermediate). Which line up nicely with fibs, so fibs verify the levels and the levels verify the use of fibs....

A bit like my dad used his sextant to verify his GPS ( when they first came out)... Levels are confirmed by fibs based on a pattern study developed in the 18th century.

This how its looking so far.
Screen shot of yesterdays exit of a short term trade in UPRO off the 15min bars.
Last week exited a swing trade on CVX last week off the daily (1hr chart).... I was in the trade before the exit but it did have a better entry than the one I took.

Primary candle study posted by JT_479, SleepyZ helped me clean up plotting at zero.
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
504 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top