Marking candle shunting on the indicator

chackiejan

New member
Hey, I've the code that marks strength candles (with star on top) & indecision candles (without star on top)
what id like to mark is a concept of candle shunting by changing the color to light green for bull & light red for bear candles for easy visibility.

1) For Bull strength candles, if open of recent green strength candle is lesser than or equal to close of past green strength candle then this two green strength candles are in shunting irrespective of non-strength candles between them. And here between open of past strength candle and close of recent strength candle provide momentum zone.

2) For Bear strength candles, if open of recent red strength candle is higher than or equal to close of past red strength candle then this two red strength candles are in shunting irrespective of non-strength candles between them. And here between open of past strength candle and close of recent strength candle provide momentum zone.

ref : 1) https://deishman.wordpress.com/2019/07/01/candles-body-shunting/
2)
I'd also like to mark the bull strength candle with green star and bear strength candle with red star on top instead of the current yellow.

Code:
def bodyheight = if BodyHeight() > (high - low) * .5 then 1 else 0;

AddChartBubble(bodyheight, high, "*", Color.YELLOW);
AddChartBubble(!bodyheight, high*1.001, AsText(high), Color.WHITE);
AddChartBubble(!bodyheight, low * .999, AsText(low), Color.WHITE, no);
 
Solution
Hey, I've the code that marks strength candles (with star on top) & indecision candles (without star on top)
what id like to mark is a concept of candle shunting by changing the color to light green for bull & light red for bear candles for easy visibility.

1) For Bull strength candles, if open of recent green strength candle is lesser than or equal to close of past green strength candle then this two green strength candles are in shunting irrespective of non-strength candles between them. And here between open of past strength candle and close of recent strength candle provide momentum zone.

2) For Bear strength candles, if open of recent red strength candle is higher than or equal to close of past red strength candle then this...
Hey, I've the code that marks strength candles (with star on top) & indecision candles (without star on top)
what id like to mark is a concept of candle shunting by changing the color to light green for bull & light red for bear candles for easy visibility.

1) For Bull strength candles, if open of recent green strength candle is lesser than or equal to close of past green strength candle then this two green strength candles are in shunting irrespective of non-strength candles between them. And here between open of past strength candle and close of recent strength candle provide momentum zone.

2) For Bear strength candles, if open of recent red strength candle is higher than or equal to close of past red strength candle then this two red strength candles are in shunting irrespective of non-strength candles between them. And here between open of past strength candle and close of recent strength candle provide momentum zone.

ref : 1) https://deishman.wordpress.com/2019/07/01/candles-body-shunting/
2)
I'd also like to mark the bull strength candle with green star and bear strength candle with red star on top instead of the current yellow.

Code:
def bodyheight = if BodyHeight() > (high - low) * .5 then 1 else 0;

AddChartBubble(bodyheight, high, "*", Color.YELLOW);
AddChartBubble(!bodyheight, high*1.001, AsText(high), Color.WHITE);
AddChartBubble(!bodyheight, low * .999, AsText(low), Color.WHITE, no);

shunting seems like an interesting a simple thing to look for.
although that web site made it much more difficult, with too many/wrong words.


this will allow you to choose to show bubbles for,
..just strength bars,
..just shunt bars,
..or both.

there are labels to describe the bubbles and colors.

Code:
# candle_shunting_00


# https://usethinkscript.com/threads/marking-candle-shunting-on-the-indicator.12943/
# Marking candle shunting on the indicator
#----------------------------------------

addlabel(1, "* , strength bars", color.yellow);
addlabel(1, "++ , shunt bars", color.yellow);

addlabel(1, "cyan and green, bull bars", color.yellow);
addlabel(1, "yellow and red, bear bars", color.yellow);


def na = double.nan;
def bn = barnumber();

def bh = BodyHeight();

def greenbar = Close > Open;
def redbar = Close < Open;


input strength_min_body_ht_ratio = 0.5;
def strength_bar = bh > (strength_min_body_ht_ratio * (high - low)); 

#AddChartBubble(strength_candle, high, "*", Color.YELLOW);


# https://deishman.wordpress.com/2019/07/01/candles-body-shunting/
#  Strength Candle can be Bullish or Bearish Strength Candle

# Bullish Strength Candle,
#   Close > Open,
#   and Body Height > 50% of Candle Height. 
def bull_strength = greenbar and strength_bar;
 
# Bearish Strength Candle,
#   Close < Open,
#   and Body Height > 50% of Candle Height
def bear_strength = redbar and strength_bar;


#  bull Candle Body Shunting, 2 bars
# Open of a bull strength candle <= close of a previous bull Strength Candle
def bull2_candle_body_shunting = (bull_strength and bull_strength[1] and open <= close[1] and close > close[1]);

#  bear Candle Body Shunting, 2 bars
# Open of a bear strength candle >= close of a previous bear Strength Candle
def bear2_candle_body_shunting = (bear_strength and bear_strength[1] and open >= close[1] and close < close[1]);

def shuntbar = bull2_candle_body_shunting or bear2_candle_body_shunting;


#mark the bull strength candle with green star and bear strength candle with red star on top instead of the current yellow.

input bubble_type = { default strength, shunt, strength_shunt };
def barstr;
def barshunt;
switch(bubble_type) {
case  strength:
barstr = 1;
barshunt = 0;
case shunt:
barstr = 0;
barshunt = 1;
case strength_shunt:
barstr = 1;
barshunt = 1;
}


# strength bubbles
AddChartBubble(barstr and !barshunt and strength_bar, high*1.001, "*",
 (if bull_strength then color.cyan else if bear_strength then color.yellow else Color.gray), yes);


# shunt bubbles
AddChartBubble(!barstr and barshunt and shuntbar,
(if greenbar then high*1.001 else low*0.999),
 "+\n+",
 (if bull2_candle_body_shunting then color.green else if bear2_candle_body_shunting then color.red else Color.gray), (if greenbar then yes else no));


# strength & shunt bubbles
AddChartBubble(barstr and barshunt and (strength_bar or shuntbar),
(if greenbar then high*1.001 else low*0.999),
(if shuntbar then "+\n+" else if strength_bar then "*" else "-"),
(if bull2_candle_body_shunting then color.green else if bear2_candle_body_shunting then color.red 
 else if bull_strength then color.cyan else if bear_strength then color.yellow
 else Color.gray),
(if greenbar then yes else no));
#

twqrMO4.jpg
 
Solution

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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