Outside Bar High/Low

offshore

Member
Hey So I have some code to indicate Outside bars but i wanted to add a little caveat to the code. If the high above the prior bar is greater than the low below the prior bar the boolean arrow indicator is green regardless if the bar is bull or bear. If the low below the prior bar is greater than the high above the prior bar, the boolean arrow is colored red regardless if the bar is bull or bear. if the high and low above and below the prior bar are the same, the arrow is colored grey. Any help would be fantastic... Thanks

plot Bullish = high >= high[1] and
low <= low[1] and
close > open;
Bullish.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_Up);
Bullish.SetDefaultColor(Color.Green);
Bullish.setLineWeight(3);

plot Bearish = high >= high[1] and
low <= low[1] and
close < open;
Bearish.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_Down);
Bearish.SetDefaultColor(Color.Red);
Bearish.setLineWeight(3);
Alert(Bullish, "1", Alert.BAR, Sound.Ding);
Alert(Bearish, "1", Alert.BAR, Sound.Ding);
 
Solution
I have a simple indicator for an inside bar with an alert in the code. The only problem is basically every bar that opens is an inside bar so my alert goes off on every bar. I was wondering if I could add something to the code to get the alert as well as the boolean indicator to print after the bar closes?

heres the code:

plot Bullish = high <= high[1] and
low >= low[1] and
close <= open;
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(Color.GREEN);
Bullish.SetLineWeight(3);

plot Bearish = high <= high[1] and
low >= low[1] and
close >= open;
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN)...
I have a simple indicator for an inside bar with an alert in the code. The only problem is basically every bar that opens is an inside bar so my alert goes off on every bar. I was wondering if I could add something to the code to get the alert as well as the boolean indicator to print after the bar closes?

heres the code:

plot Bullish = high <= high[1] and
low >= low[1] and
close <= open;
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(Color.GREEN);
Bullish.SetLineWeight(3);

plot Bearish = high <= high[1] and
low >= low[1] and
close >= open;
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(Color.RED);
Bearish.SetLineWeight(3);

Alert(Bullish, "1", Alert.BAR, Sound.Ding);
Alert(Bearish, "1", Alert.BAR, Sound.Ding);
 

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

I have a simple indicator for an inside bar with an alert in the code. The only problem is basically every bar that opens is an inside bar so my alert goes off on every bar. I was wondering if I could add something to the code to get the alert as well as the boolean indicator to print after the bar closes?

heres the code:

plot Bullish = high <= high[1] and
low >= low[1] and
close <= open;
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(Color.GREEN);
Bullish.SetLineWeight(3);

plot Bearish = high <= high[1] and
low >= low[1] and
close >= open;
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(Color.RED);
Bearish.SetLineWeight(3);

Alert(Bullish, "1", Alert.BAR, Sound.Ding);
Alert(Bearish, "1", Alert.BAR, Sound.Ding);

This may help

Ruby:
plot Bullish = high <= high[1] and
low >= low[1] and
close <= open;
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(Color.GREEN);
Bullish.SetLineWeight(3);

plot Bearish = high <= high[1] and
low >= low[1] and
close >= open;
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(Color.RED);
Bearish.SetLineWeight(3);

Alert(Bullish[1], "Bullish", Alert.BAR, Sound.Ding);
Alert(Bearish[1], "Bearish", Alert.BAR, Sound.Ding);
 
Solution
Hey thanks a lot @SleepyZ .... is there any way I can add the caveat to this set ouf code for the outside bars?
Hey So I have some code to indicate Outside bars but i wanted to add a little caveat to the code. If the high above the prior bar is greater than the low below the prior bar the boolean arrow indicator is green regardless if the bar is bull or bear. If the low below the prior bar is greater than the high above the prior bar, the boolean arrow is colored red regardless if the bar is bull or bear. if the high and low above and below the prior bar are the same, the arrow is colored grey. Any help would be fantastic... Thanks

plot Bullish = high >= high[1] and
low <= low[1] and
close > open;
Bullish.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_Up);
Bullish.SetDefaultColor(Color.Green);
Bullish.setLineWeight(3);

plot Bearish = high >= high[1] and
low <= low[1] and
close < open;
Bearish.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_Down);
Bearish.SetDefaultColor(Color.Red);
Bearish.setLineWeight(3);
Alert(Bullish, "1", Alert.BAR, Sound.Ding);
Alert(Bearish, "1", Alert.BAR, Sound.Ding);
 
Hey thanks a lot @SleepyZ .... is there any way I can add the caveat to this set ouf code for the outside bars?

This should help

Screenshot-2022-12-28-092135.png
Ruby:
#Hey So I have some code to indicate Outside bars but i wanted to add a little caveat to the code. If the high above the prior bar is greater than the low below the prior bar the boolean arrow indicator is green regardless if the bar is bull or bear. If the low below the prior bar is greater than the high above the prior bar, the boolean arrow is colored red regardless if the bar is bull or bear. if the high and low above and below the prior bar are the same, the arrow is colored grey. Any help would be fantastic... Thanks

plot Bullish = high >= high[1] and
low <= low[1] and
close > open;
def bull  = if Bullish and (high - high[1]) > (low[1] - low)
            then 1
            else if (high - high[1]) < (low[1] - low)
            then -1
            else 0;
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.AssignValueColor(if bull == 1 then Color.GREEN else if bull == -1 then Color.RED else Color.GRAY);
Bullish.SetLineWeight(3);

plot Bearish = high >= high[1] and
low <= low[1] and
close < open;
def bear  = if Bearish and (high - high[1]) > (low[1] - low)
            then 1
            else if (high - high[1]) < (low[1] - low)
            then -1
            else 0;
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.AssignValueColor(if bear == 1 then Color.GREEN else if bear == -1 then Color.RED else Color.GRAY);
Bearish.SetLineWeight(3);
Alert(Bullish, "1", Alert.BAR, Sound.Ding);
Alert(Bearish, "1", Alert.BAR, Sound.Ding);

input test = yes;
AddChartBubble(test and (Bullish or Bearish), if Bearish then high * 1.005 else low * .995, "H: " + (high - high[1]) + "\nL: " + (low[1] - low), if (bull == 1 or bear == 1) then Color.GREEN else if (bull == -1 or bear == -1) then Color.RED else Color.GRAY, if Bullish then no else yes);
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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