Highlight three candles consecutively making higher lows

Status
Not open for further replies.

phil48

New member
Hello, I'm trying to make a chart study to highlight three candles that have higher lows within 3 bars.

plot x =(low[3]<low[2] and low[2]<low[1]) within 3 bars;
AssignPriceColor(if x is true then Color.violet else Color.current);


It's showing random sequences instead of the simple pattern I'm trying to see. I've looked through the site for similar help, but a lot of them involved lines and labels that I don't need and can't modify to get what I want.

Any help would be greatly appreciated!

Thanks!

iitI86T.png
 
Last edited:
Solution
Hello, I'm trying to make a chart study to highlight three candles that have higher lows within 3 bars.

plot x =(low[3]<low[2] and low[2]<low[1]) within 3 bars;
AssignPriceColor(if x is true then Color.violet else Color.current);


It's showing random sequences instead of the simple pattern I'm trying to see. I've looked through the site for similar help, but a lot of them involved lines and labels that I don't need and can't modify to get what I want.

color a bar when 3 bars in a row have a higher low
can draw a dot below the bar.

sometimes it looks like a lower lower is incorrectly marked. but it is the first bar in a new series of higher lows.
this is hard coded to look for 3 in a row.

Code:
# hilows_3x_01

#...
Hello, I'm trying to make a chart study to highlight three candles that have higher lows within 3 bars.

plot x =(low[3]<low[2] and low[2]<low[1]) within 3 bars;
AssignPriceColor(if x is true then Color.violet else Color.current);


It's showing random sequences instead of the simple pattern I'm trying to see. I've looked through the site for similar help, but a lot of them involved lines and labels that I don't need and can't modify to get what I want.

its not random colors.
if there has been 3 sequencial higher lows, within the last 5 bars , it will be true.
offsets of 123, 234, 345,

if there are 3 higher lows in a row, do you want just those 3 candles highlighted?
 
Last edited:

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

its not random colors.
if there has been 3 sequencial higher lows, within the last 5 bars , it will be true.
offsets of 123, 234, 345,
Thanks @halcyonguy but I'm not sure I understand. Unlike the sequence that I numbered "123" in the screenshot, a few candles with declining lows are highlighted in violet. Also, I wrote within 3 bars, not within the last 5 bars, so I'm not entirely sure what you meant within the last 5 bars. Where would the 5 be coming from? I'm really just trying to get the actual sequence highlighted. Thanks again!
 
Thanks @halcyonguy but I'm not sure I understand. Unlike the sequence that I numbered "123" in the screenshot, a few candles with declining lows are highlighted in violet. Also, I wrote within 3 bars, not within the last 5 bars, so I'm not entirely sure what you meant within the last 5 bars. Where would the 5 be coming from? I'm really just trying to get the actual sequence highlighted. Thanks again!
let me try again in explaining how your x formula works,
it's not what you want, but i think it's important to understand why it doesn't work.

Those 3 bars you have numbered, 123,
do you see how the 3 bars after them are purple?
That is when your x formula is true,
the 3 bars after a sequence. not the 3 bars during the higher lows.

=(low[3]<low[2] and low[2]<low[1])
this is looking at the 3 bars before the current bar.
when 3 higher lows happen, ( like bars 123),
on the bar after 3, this part of the formula will be true.

within 3 bars;
when you add this to the formula above,
x will be true on the 3 bars after bar 3.

instead of writing , within 3 bars,
you could write a new formula,
def y = x[0] or x[1] or x[2];


or you could write it like this,

x =(low[3]<low[2] and low[2]<low[1])
or
(low[4]<low[3] and low[3]<low[2])
or
(low[5]<low[4] and low[4]<low[3])

now do you see what i meant when i wrote these groups of offset numbers.
offsets of 123, 234, 345,

a total span of 5 bars....
from an offset of 1 to an offset of 5

......

Give me an hour or so and I'll see about writing what you really want
 
Hello, I'm trying to make a chart study to highlight three candles that have higher lows within 3 bars.

plot x =(low[3]<low[2] and low[2]<low[1]) within 3 bars;
AssignPriceColor(if x is true then Color.violet else Color.current);


It's showing random sequences instead of the simple pattern I'm trying to see. I've looked through the site for similar help, but a lot of them involved lines and labels that I don't need and can't modify to get what I want.

color a bar when 3 bars in a row have a higher low
can draw a dot below the bar.

sometimes it looks like a lower lower is incorrectly marked. but it is the first bar in a new series of higher lows.
this is hard coded to look for 3 in a row.

Code:
# hilows_3x_01

# https://usethinkscript.com/threads/highlight-three-candles-consecutively-making-higher-lows.12969/
# color bars of, higher lows, 3x in a row

#def bn = BarNumber();
def na = double.nan;
def t =(low[2]<low[1] and low[1]<low[0]);

# check if 3 bars in a row had higher lows,
# last 2 bars have altered rules, so they don't try to read a future non existant bar
def hilo;
if !isnan(close[-2]) then {
  hilo = t[-2] or t[-1] or t[0];
} else if !isnan(close[-1]) then {
  hilo = t[-1] or t[0];
} else {
  hilo = t[0];
}

input change_bar_color = yes;
AssignPriceColor(if change_bar_color and hilo then Color.violet else Color.current);

input dots_on_higherlows = no;
plot d = if dots_on_higherlows and hilo then low*0.998 else na;
d.SetPaintingStrategy(PaintingStrategy.POINTS);
d.SetDefaultColor(Color.cyan);
d.setlineweight(3);
d.hidebubble();
#

EMR 15min 10/10/22
TSaFilS.jpg
 
Last edited:
Solution
Hello, I'm trying to make a chart study to highlight three candles that have higher lows within 3 bars.

plot x =(low[3]<low[2] and low[2]<low[1]) within 3 bars;
AssignPriceColor(if x is true then Color.violet else Color.current);


It's showing random sequences instead of the simple pattern I'm trying to see. I've looked through the site for similar help, but a lot of them involved lines and labels that I don't need and can't modify to get what I want.

can select any minimum quantity of higher low bars to look for.
(max is set by u=50)

options,
..change higher low bars color to violet
..draw dots under the higher low bars
....first bar is yellow, others are violet
..draw small yellow arrow above the first bar in series

See complete script found here: https://usethinkscript.com/threads/hilo_-x-bars-for-thinkorswim.12974/

EMR 15min 10/10/22
min qty set to 3
PsGL52c.jpg
 
Last edited by a moderator:
Status
Not open for further replies.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
328 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