Outside Bars and/or Inside Bars (Candle) Combinations For ThinkOrSwim

Thepremier

New member
Can someone help me with a script for an outside day and and an inside day? I would like to create a scan for them.

 
Last edited:

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

I am using the above logic but I am seeing some inconsistencies - It seems it does not highlight all the candles that are inside -

#########################
# Inside and Outside Bar
# Mobius
# 8.7.2017

def inside = high < high[1] and low > low[1];
def outside = high > high[1] or low < low[1];
AssignPriceColor(if inside
then color.yellow
else if outside
then color.GRAY
else color.current);
#
########################https://ibb.co/bztrRWb

https://ibb.co/bztrRWb

I understand the logic ..........I have tried chart bubble also and bubble works. But the color of the candle is off
 
Last edited by a moderator:
I am using the above logic but I am seeing some inconsistencies - It seems it does not highlight all the candles that are inside -

#########################
# Inside and Outside Bar
# Mobius
# 8.7.2017

def inside = high < high[1] and low > low[1];
def outside = high > high[1] or low < low[1];
AssignPriceColor(if inside
then color.yellow
else if outside
then color.GRAY
else color.current);
#
########################https://ibb.co/bztrRWb

https://ibb.co/bztrRWb

I understand the logic ..........I have tried chart bubble also and bubble works. But the color of the candle is off
The yellow candle is defined according to the script that you included in your post.
The chart bubble is obviously using a definition in a script that you didn't share.

Modify the inside bar definition of the script coloring your candle to match the inside bar definition in your chart bubble.
 
I am using the above logic but I am seeing some inconsistencies - It seems it does not highlight all the candles that are inside -

#########################
# Inside and Outside Bar
# Mobius
# 8.7.2017

def inside = high < high[1] and low > low[1];
def outside = high > high[1] or low < low[1];
AssignPriceColor(if inside
then color.yellow
else if outside
then color.GRAY
else color.current);
#
########################https://ibb.co/bztrRWb

https://ibb.co/bztrRWb

I understand the logic ..........I have tried chart bubble also and bubble works. But the color of the candle is off

Why do you say 'the logic above', and then list code 'below' your words? Are you referencing an entirely different code somewhere? If so, mention the post number. (there are 82 posts before yours, so it's hard to to tell which 'post above' you are referring to).
if you click on a post number, the web link is updated to point to that post. then copy/paste the link when you make a post of your own.

can you list A stock and chart time of where you see these differences?
What exactly are you looking for that you are not seeing?
the formula for a one bar inside pattern looks right, so it should be working..

I was going to say, the outside formula is wrong, but it's just a different way of doing it. Below is a link to what I have seen, A large bar that is larger than the previous bar.


inside bar
large bar, then smaller one
https://priceaction.com/price-actio...e bar” pattern is,than the previous bar's low.


outside bar
small bar, then larger one
https://www.newtraderu.com/2021/10/29/outside-bar-candlestick-pattern/
 
Last edited:
Thanks for your reply......Let's try again.

1. I used the code from post #2
https://usethinkscript.com/threads/...e-combinations-for-thinkorswim.8336/post-1397

2. I looked up CCL on 5 Min chart
https://ibb.co/4WYKcc6

3. The code logic is - if it is an inside bar color should be cyan. That is what I understand but I am seeing "4" inside bars that are green.

Now, I am aware of the fact the last line "else color.current" was the cause of my confusion. In the case of 4 inside bars that were painted green high or low were equal to the previous bar thus the last line of the code was executed.

Now the question is, what do you call a bar when its high or low is equal to the high or low of the previous bar?
 
Can anyone help me with my attempt here to simply identify outside (engulfing) bars but painting the bar / candle.

# Outside Bar Colored


def outsideBarID = high > high [1] and low < Low [1];

def bar = barNumber();

AssignPriceColor(if bar == outsideBarID

then color.plum

else color.current);
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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