# Is it possible to create a script based on double topping tails

#### Piper2808t

##### Member
2019 Donor
VIP
As per Oliver Valez video is this possible to create, perhaps a bubble or line

Solution
As per Oliver Valez video is this possible to create, perhaps a bubble or line

yes

a bubble where? and displays what?
if a line , from where to where?

can find 2 long tail bars. just have to define the limits on the ratios of,
. top wick to bottom wick
..bodyheight to long wick

this could be modified as a starting point... looking at that study, those formulas are too complicated, i will see about making up something
As per Oliver Valez video is this possible to create, perhaps a bubble or line

yes

a bubble where? and displays what?
if a line , from where to where?

can find 2 long tail bars. just have to define the limits on the ratios of,
. top wick to bottom wick
..bodyheight to long wick

this could be modified as a starting point... looking at that study, those formulas are too complicated, i will see about making up something

Last edited:
As per Oliver Valez video is this possible to create, perhaps a bubble or line

identify pin bars and tail bars

when a pin bar or tail bar is found, a bubble is drawn, with a P or T in it.
if 2 bulls or 2 bears are in a row, then a vertical line is drawn.

i searched a little but didn't find any definite formulas. so i measured a few candles and came up with some ratios.
formulas are based on the ratios of long wick and short wick heights to the body height.

ratios, a wick to body
input pin_shortwick_lower_rng = 0.0;
input pin_shortwick_upper_rng = 1.0;
input pin_longwick_min = 1.9;

if bodyheight is 0, or a wick is 0, then it assigns 0.5 x ticksize as height.

ref

Code:
``````#pin_bar_tail_bar

#Is it possible to create a script based on double topping tails

def t = ticksize();
def zero = (t/2);

def ht = high - low;
def body = if BodyHeight() == 0 then zero else bodyheight();
def bodytop = Max(open, close);
def bodybot = Min(open, close);
def wicktop = if (high - bodytop) == 0 then zero else (high - bodytop);
def wickbot = if (bodybot - low)  == 0 then zero else (bodybot - low);

def up = close > open;
def dwn = close < open;

input use_bar_direction = no;

# pin bar - small body
# tail bar - bigger body

def body_ht = body/ht;

# ratios , top wick to bottom wick
def wickt_wickb = wicktop/wickbot;
def wickb_wickt = wickbot/wicktop;

def wick_long_wick_short = max(wicktop, wickbot) / min(wicktop, wickbot);

# use these
# ratios , wick to body
def wickt_body = wicktop/body;
def wickb_body = wickbot/body;

# ratios
#input pin_shortwick_lower_rng = 0.3;
input pin_shortwick_lower_rng = 0.0;
input pin_shortwick_upper_rng = 1.0;
input pin_longwick_min = 1.9;

def tail_shortwick_max = pin_shortwick_lower_rng;
def tail_longwick_upper_rng = pin_longwick_min;
def tail_longwick_lower_rng = pin_shortwick_upper_rng;

def pin_bull = (wickt_body >= pin_shortwick_lower_rng) and (wickt_body <= pin_shortwick_upper_rng) and (wickb_body > pin_longwick_min);
def pin_bear = (wickt_body > pin_longwick_min) and (wickb_body >= pin_shortwick_lower_rng) and (wickb_body <= pin_shortwick_upper_rng);

def tail_bull = (wickt_body <= tail_shortwick_max) and (wickb_body >= tail_longwick_lower_rng) and (wickb_body <= tail_longwick_upper_rng);
def tail_bear = (wickt_body >= tail_longwick_lower_rng) and (wickt_body <= tail_longwick_upper_rng) and (wickb_body <= tail_shortwick_max);

# if 2 in a row, then vert line

def bull_dbl = ((pin_bull[1] and pin_bull[0]) or (pin_bull[1] and tail_bull[0]) or (tail_bull[1] and tail_bull[0]) or (tail_bull[1] and pin_bull[0]));
def bear_dbl = ((pin_bear[1] and pin_bear[0]) or (pin_bear[1] and tail_bear[0]) or (tail_bear[1] and tail_bear[0]) or (tail_bear[1] and pin_bear[0]));

input test1 = no;
input test2_all = no;
addchartbubble((test1 and (pin_bull or tail_bull)), low,
wickt_body + "\n" +
wickb_body
, color.cyan, no);

addchartbubble((test2_all or (test1 and (pin_bear or tail_bear))), high,
wickt_body + "\n" +
wickb_body + "\n" +
wick_long_wick_short + " wL/wS"
, color.yellow, yes);
#``````

pin bar and tail bars identified
2 in a row has a vertical line

i measured some candles, put the numbers into excel, and came up with the ratios. then guessed at some number ranges.

Last edited:

87k+ Posts
315 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?