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:
Great scrip!!!! Is there a way to make a chart alert? for this?here is a modified version of your study,
..it finds inside bars and outside bars , of 1 and 2 bars.
..inside bars are drawn with cyan , outside bars are drawn with yellow.
..a small arrow is drawn on the big candle. cyan up for inside. yellow down for outside
..it draws lines from the big candle.
..patterns with 2 small bars have a triangle drawn on big candle.
the 2 formulas, insidebar and outsidebar, remove the same, smaller patterns within a larger one.
Code:# inside_outside_01 # https://usethinkscript.com/threads/inside-outside-bar.12396/ # inside bar and outside bar code, def na = double.nan; def price = close; # inside bar - a big candle and smaller candles after it def inside1 = high > high[-1] and low < low[-1]; def inside2 = inside1 and high > high[-2] and low < low[-2]; # outside bar - a big candle with smaller candles before it def outside1 = high > high[1] and low < low[1]; def outside2 = outside1 and high > high[2] and low < low[2]; # remove small insides within larger insides def insidebar = if inside2[1] then 0 else if inside2 then 2 else if inside1 then 1 else 0; # remove small outsides within larger outsides def outsidebar = if outside2[-1] then 0 else if outside2 then 2 else if outside1 then 1 else 0; input show_small_arrows = yes; # inside shapes above candles, up wedge plot zin = if !show_small_arrows then 0 else insidebar; zin.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_up); zin.SetDefaultColor(Color.cyan); zin.setlineweight(2); zin.hidebubble(); # outside shapes below candles, down wedge plot zout = if !show_small_arrows then 0 else outsidebar; zout.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_down); zout.SetDefaultColor(Color.yellow); zout.setlineweight(2); zout.hidebubble(); plot inside_top = if insidebar[0] > 0 then high[0] else if insidebar[1] > 0 then high[1] else if insidebar[2] > 1 then high[2] else na; plot inside_bot = if insidebar[0] > 0 then low[0] else if insidebar[1] > 0 then low[1] else if insidebar[2] > 1 then low[2] else na; inside_top.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); inside_top.SetDefaultColor(Color.cyan); inside_top.hidebubble(); inside_bot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); inside_bot.SetDefaultColor(Color.cyan); inside_bot.hidebubble(); plot outside_top = if outsidebar[0] > 0 then high[0] else if outsidebar[-1] > 0 then high[-1] else if outsidebar[-2] > 1 then high[-2] else na; plot outside_bot = if outsidebar[0] > 0 then low[0] else if outsidebar[-1] > 0 then low[-1] else if outsidebar[-2] > 1 then low[-2] else na; outside_top.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); outside_top.SetDefaultColor(Color.yellow); outside_top.hidebubble(); outside_bot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); outside_bot.SetDefaultColor(Color.yellow); outside_bot.hidebubble(); input show_double_shapes = yes; def vert = 0.006; #plot y1 = if inside1 then high*1.01 else na; plot y1 = if show_double_shapes and inside2 then high*(1+vert) else na; y1.SetPaintingStrategy(PaintingStrategy.triangles); y1.SetDefaultColor(Color.cyan); y1.setlineweight(4); y1.hidebubble(); #plot y2 = if inside2 then high*1.02 else na; plot y2 = if show_double_shapes and outside2 then low*(1-vert) else na; y2.SetPaintingStrategy(PaintingStrategy.triangles); y2.SetDefaultColor(Color.yellow); y2.setlineweight(4); y2.hidebubble(); #
Add this to the bottom of script:Great scrip!!!! Is there a way to make a chart alert? for this?
plot ChartAlert = insidebar or outsidebar;
chartAlert.hide();
The yellow candle is defined according to the script that you included in your post.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
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
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
How to create alerts for Outside Bars | Questions | 1 | ||
M | show which stocks trade outside the zone | Questions | 2 | |
O | Outside Bar High/Low | Questions | 4 | |
K | Full candle outside of Bollinger Band | Questions | 7 | |
D | Inside Bar OutSide Bar Clouds For ThinkOrSwim | Questions | 4 |
Start a new thread and receive assistance from our community.
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.
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.