addchartbubbles

Nari2007

Member
hello Fellow Traders,
looking for some assistance with some basic coding using addchartbubble,,

id like to add chart bubble to boxhigh/boxlow & boxhigh1/boxlow1

please see code below,, any assistance would be greatly appreciated

DEF SUPPORT2 = low;
DEF MIN = Min(open, close);

declare upper;

input HideBalance = no;

input HideBoxLines = no;

input HideCloud = no;

input BarsUsedForRange = 5;

input BarsRequiredToRemainInRange = 7;

# Identify Consolidation

def MINMIN = lowest(MIN[1], BarsUsedForRange);

def SUPPORT2L = lowest(SUPPORT2[1], BarsUsedForRange);

def maxMIN = lowest(MINMIN, BarsRequiredToRemainInRange);

def maxSUPPORT2 = lowest(SUPPORT2L, BarsRequiredToRemainInRange);

def MINn = if maxMIN == maxMIN[1] or maxSUPPORT2 == maxSUPPORT2 then maxMIN else MINn[1];

def SUPPORT2n = if maxMIN == maxMIN[1] or maxSUPPORT2 == maxSUPPORT2 then maxSUPPORT2 else SUPPORT2n[1];

def Bh = if MIN >= MINn and MINn == MINn[1] then MINn else double.nan;

def Bl = if SUPPORT2 >= SUPPORT2n and SUPPORT2n == SUPPORT2n[1] then SUPPORT2n else double.nan;


def CountH = if isnan(Bh) or isnan(Bl) then 2 else CountH[1] + 1;

def CountL = if isnan(Bh) or isnan(Bl) then 2 else CountL[1] + 1;

def ExpH = if barnumber() == 1 then double.nan else

if CountH[-BarsRequiredToRemainInRange] >= BarsRequiredToRemainInRange then MINn[-BarsRequiredToRemainInRange] else

if MIN >= ExpH[1] then ExpH[1] else double.nan;

def ExpL = if barnumber() == 1 then double.nan else

if Countl[-BarsRequiredToRemainInRange] >= BarsRequiredToRemainInRange then SUPPORT2n[-BarsRequiredToRemainInRange] else

if SUPPORT2 >= ExpL[1] then ExpL[1] else double.nan;

# Plot the High and Low of the Box; Paint Cloud

plot BoxHigh = if !isnan(expL) and !isnan(ExpH) then ExpH else double.nan;

plot BoxLow = if !isnan(expL) and !isnan(ExpH) then ExpL else double.nan;

boxhigh.setdefaultColor(color.dark_RED);

BoxHigh.setpaintingStrategy(paintingStrategy.HORIZONTAL);

BoxLow.setpaintingStrategy(paintingStrategy.HORIZONTAL);

BoxLow.setdefaultColor(color.LIGHT_GREEN );

BoxHigh.SETHIDING(HideBoxLines);

BoxLow.SETHIDING(HideBoxLines);
BOXHigh.SetLineWeight(3);
BOXLOW.SetLineWeight(3);
addcloud(if !HideCloud then BoxHigh else double.nan, BoxLow, color.LIGHT_GREEN , color.LIGHT_GREEN );

# Things to the Right of a Finished Box

def eH = if barnumber() == 1 then double.nan else if !isnan(BoxHigh[1]) and isnan(BoxHigh) then BoxHigh[1] else eh[1];

def eL = if barnumber() == 1 then double.nan else if !isnan(BoxLow[1]) and isnan(BoxLow) then BoxLow[1] else el[1];

plot Balance = if isnan(boxhigh) and isnan(boxlow) then (eh+el)/2 else double.nan;

Balance.SETHIDING(HideBalance);

Balance.setdefaultColor(COLOR.LIGHT_GREEN );

Balance.setpaintingStrategy(PAIntingStrategy.SQUARES);

plot RH = (balance *2)-el ;
plot RL = (balance *2)-eh ;



addcloud(if !HideCloud then rh else double.nan, rl, color.GRAY, color.GRAY);


rh.setdefaultColor(color.DARK_red);
rh.setpaintingStrategy(paintingStrategy.HORIZONTAL);
rl.setdefaultColor(color.DARK_green);
rl.setpaintingStrategy(paintingStrategy.HORIZONTAL);
RH.SetLineWeight(3);
RL.SetLineWeight(3);


##############################################################

DEF H = high;
DEF max = Max(open, close);


# Identify Consolidation

def HH1 = highest(h[1], BarsUsedForRange);
def LL1 = highest(max[1], BarsUsedForRange);
def maxH1 = highest(hh1, BarsRequiredToRemainInRange);
def maxL1 = highest(ll1, BarsRequiredToRemainInRange);

def HHn1 = if maxH1 == maxH1[1] or maxL1 == maxL1 then maxH1 else HHn1[1];

def LLn1 = if maxH1 == maxH1[1] or maxL1 == maxL1 then maxL1 else LLn1[1];

def Bh1 = if h <= HHn1 and HHn1 == HHn1[1] then HHn1 else double.nan;

def Bl1 = if max <= LLn1 and LLn1 == LLn1[1] then LLn1 else double.nan;

def CountH1 = if isnan(Bh1) or isnan(Bl1) then 2 else CountH1[1] + 1;

def CountL1 = if isnan(Bh1) or isnan(Bl1) then 2 else CountL1[1] + 1;

def ExpH1 = if barnumber() == 1 then double.nan else

if CountH1[-BarsRequiredToRemainInRange] >= BarsRequiredToRemainInRange then HHn1[-BarsRequiredToRemainInRange] else

if H <= ExpH1[1] then ExpH1[1] else double.nan;

def ExpL1 = if barnumber() == 1 then double.nan else

if Countl1[-BarsRequiredToRemainInRange] >= BarsRequiredToRemainInRange then LLn1[-BarsRequiredToRemainInRange] else

if max <= ExpL1[1] then ExpL1[1] else double.nan;


# Plot the High and Low of the Box; Paint Cloud

plot BoxHigh1 = if !isnan(expL1) and !isnan(ExpH1) then ExpH1 else double.nan;


plot BoxLow1 = if !isnan(expL1) and !isnan(ExpH1) then ExpL1 else double.nan;

boxhigh1.setdefaultColor(color.dark_RED);

BoxHigh1.setpaintingStrategy(paintingStrategy.HORIZONTAL);

BoxLow1.setpaintingStrategy(paintingStrategy.HORIZONTAL);

BoxLow1.setdefaultColor(color.dark_GREEN);

BoxHigh1.SETHIDING(HideBoxLines);

BoxLow1.SETHIDING(HideBoxLines);
BOXHigh1.SetLineWeight(3);
BOXLOW1.SetLineWeight(3);
addcloud(if !HideCloud then BoxHigh1 else double.nan, BoxLow1, color.pink, color.pink);

# Things to the Right of a Finished Box

def eH1 = if barnumber() == 1 then double.nan else if !isnan(BoxHigh1[1]) and isnan(BoxHigh1) then BoxHigh1[1] else eh1[1];

def eL1 = if barnumber() == 1 then double.nan else if !isnan(BoxLow1[1]) and isnan(BoxLow1) then BoxLow1[1] else el1[1];


plot Balance1 = if isnan(boxhigh1) and isnan(boxlow1) then (eh1+el1)/2 else double.nan;

Balance1.SETHIDING(HideBalance);

Balance1.setdefaultColor(COLOR.PINK);

Balance1.setpaintingStrategy(PAIntingStrategy.SQUARES);

plot RH1 = (balance1 *2)-el1 ;
plot RL1 = (balance1 *2)-eh1 ;



addcloud(if !HideCloud then rh1 else double.nan, rl1, color.GRAY, color.GRAY);


rh1.setdefaultColor(color.DARK_red);
rh1.setpaintingStrategy(paintingStrategy.HORIZONTAL);
rl1.setdefaultColor(color.DARK_green);
rl1.setpaintingStrategy(paintingStrategy.HORIZONTAL);
RH1.SetLineWeight(3);
RL1.SetLineWeight(3);
 
hello Fellow Traders,
looking for some assistance with some basic coding using addchartbubble,,

id like to add chart bubble to boxhigh/boxlow & boxhigh1/boxlow1

please see code below,, any assistance would be greatly appreciated

DEF SUPPORT2 = low;
DEF MIN = Min(open, close);

declare upper;

input HideBalance = no;

input HideBoxLines = no;

input HideCloud = no;

input BarsUsedForRange = 5;

input BarsRequiredToRemainInRange = 7;

# Identify Consolidation

def MINMIN = lowest(MIN[1], BarsUsedForRange);

def SUPPORT2L = lowest(SUPPORT2[1], BarsUsedForRange);

def maxMIN = lowest(MINMIN, BarsRequiredToRemainInRange);

def maxSUPPORT2 = lowest(SUPPORT2L, BarsRequiredToRemainInRange);

def MINn = if maxMIN == maxMIN[1] or maxSUPPORT2 == maxSUPPORT2 then maxMIN else MINn[1];

def SUPPORT2n = if maxMIN == maxMIN[1] or maxSUPPORT2 == maxSUPPORT2 then maxSUPPORT2 else SUPPORT2n[1];

def Bh = if MIN >= MINn and MINn == MINn[1] then MINn else double.nan;

def Bl = if SUPPORT2 >= SUPPORT2n and SUPPORT2n == SUPPORT2n[1] then SUPPORT2n else double.nan;


def CountH = if isnan(Bh) or isnan(Bl) then 2 else CountH[1] + 1;

def CountL = if isnan(Bh) or isnan(Bl) then 2 else CountL[1] + 1;

def ExpH = if barnumber() == 1 then double.nan else

if CountH[-BarsRequiredToRemainInRange] >= BarsRequiredToRemainInRange then MINn[-BarsRequiredToRemainInRange] else

if MIN >= ExpH[1] then ExpH[1] else double.nan;

def ExpL = if barnumber() == 1 then double.nan else

if Countl[-BarsRequiredToRemainInRange] >= BarsRequiredToRemainInRange then SUPPORT2n[-BarsRequiredToRemainInRange] else

if SUPPORT2 >= ExpL[1] then ExpL[1] else double.nan;

# Plot the High and Low of the Box; Paint Cloud

plot BoxHigh = if !isnan(expL) and !isnan(ExpH) then ExpH else double.nan;

plot BoxLow = if !isnan(expL) and !isnan(ExpH) then ExpL else double.nan;

boxhigh.setdefaultColor(color.dark_RED);

BoxHigh.setpaintingStrategy(paintingStrategy.HORIZONTAL);

BoxLow.setpaintingStrategy(paintingStrategy.HORIZONTAL);

BoxLow.setdefaultColor(color.LIGHT_GREEN );

BoxHigh.SETHIDING(HideBoxLines);

BoxLow.SETHIDING(HideBoxLines);
BOXHigh.SetLineWeight(3);
BOXLOW.SetLineWeight(3);
addcloud(if !HideCloud then BoxHigh else double.nan, BoxLow, color.LIGHT_GREEN , color.LIGHT_GREEN );

# Things to the Right of a Finished Box

def eH = if barnumber() == 1 then double.nan else if !isnan(BoxHigh[1]) and isnan(BoxHigh) then BoxHigh[1] else eh[1];

def eL = if barnumber() == 1 then double.nan else if !isnan(BoxLow[1]) and isnan(BoxLow) then BoxLow[1] else el[1];

plot Balance = if isnan(boxhigh) and isnan(boxlow) then (eh+el)/2 else double.nan;

Balance.SETHIDING(HideBalance);

Balance.setdefaultColor(COLOR.LIGHT_GREEN );

Balance.setpaintingStrategy(PAIntingStrategy.SQUARES);

plot RH = (balance *2)-el ;
plot RL = (balance *2)-eh ;



addcloud(if !HideCloud then rh else double.nan, rl, color.GRAY, color.GRAY);


rh.setdefaultColor(color.DARK_red);
rh.setpaintingStrategy(paintingStrategy.HORIZONTAL);
rl.setdefaultColor(color.DARK_green);
rl.setpaintingStrategy(paintingStrategy.HORIZONTAL);
RH.SetLineWeight(3);
RL.SetLineWeight(3);


##############################################################

DEF H = high;
DEF max = Max(open, close);


# Identify Consolidation

def HH1 = highest(h[1], BarsUsedForRange);
def LL1 = highest(max[1], BarsUsedForRange);
def maxH1 = highest(hh1, BarsRequiredToRemainInRange);
def maxL1 = highest(ll1, BarsRequiredToRemainInRange);

def HHn1 = if maxH1 == maxH1[1] or maxL1 == maxL1 then maxH1 else HHn1[1];

def LLn1 = if maxH1 == maxH1[1] or maxL1 == maxL1 then maxL1 else LLn1[1];

def Bh1 = if h <= HHn1 and HHn1 == HHn1[1] then HHn1 else double.nan;

def Bl1 = if max <= LLn1 and LLn1 == LLn1[1] then LLn1 else double.nan;

def CountH1 = if isnan(Bh1) or isnan(Bl1) then 2 else CountH1[1] + 1;

def CountL1 = if isnan(Bh1) or isnan(Bl1) then 2 else CountL1[1] + 1;

def ExpH1 = if barnumber() == 1 then double.nan else

if CountH1[-BarsRequiredToRemainInRange] >= BarsRequiredToRemainInRange then HHn1[-BarsRequiredToRemainInRange] else

if H <= ExpH1[1] then ExpH1[1] else double.nan;

def ExpL1 = if barnumber() == 1 then double.nan else

if Countl1[-BarsRequiredToRemainInRange] >= BarsRequiredToRemainInRange then LLn1[-BarsRequiredToRemainInRange] else

if max <= ExpL1[1] then ExpL1[1] else double.nan;


# Plot the High and Low of the Box; Paint Cloud

plot BoxHigh1 = if !isnan(expL1) and !isnan(ExpH1) then ExpH1 else double.nan;


plot BoxLow1 = if !isnan(expL1) and !isnan(ExpH1) then ExpL1 else double.nan;

boxhigh1.setdefaultColor(color.dark_RED);

BoxHigh1.setpaintingStrategy(paintingStrategy.HORIZONTAL);

BoxLow1.setpaintingStrategy(paintingStrategy.HORIZONTAL);

BoxLow1.setdefaultColor(color.dark_GREEN);

BoxHigh1.SETHIDING(HideBoxLines);

BoxLow1.SETHIDING(HideBoxLines);
BOXHigh1.SetLineWeight(3);
BOXLOW1.SetLineWeight(3);
addcloud(if !HideCloud then BoxHigh1 else double.nan, BoxLow1, color.pink, color.pink);

# Things to the Right of a Finished Box

def eH1 = if barnumber() == 1 then double.nan else if !isnan(BoxHigh1[1]) and isnan(BoxHigh1) then BoxHigh1[1] else eh1[1];

def eL1 = if barnumber() == 1 then double.nan else if !isnan(BoxLow1[1]) and isnan(BoxLow1) then BoxLow1[1] else el1[1];


plot Balance1 = if isnan(boxhigh1) and isnan(boxlow1) then (eh1+el1)/2 else double.nan;

Balance1.SETHIDING(HideBalance);

Balance1.setdefaultColor(COLOR.PINK);

Balance1.setpaintingStrategy(PAIntingStrategy.SQUARES);

plot RH1 = (balance1 *2)-el1 ;
plot RL1 = (balance1 *2)-eh1 ;



addcloud(if !HideCloud then rh1 else double.nan, rl1, color.GRAY, color.GRAY);


rh1.setdefaultColor(color.DARK_red);
rh1.setpaintingStrategy(paintingStrategy.HORIZONTAL);
rl1.setdefaultColor(color.DARK_green);
rl1.setpaintingStrategy(paintingStrategy.HORIZONTAL);
RH1.SetLineWeight(3);
RL1.SetLineWeight(3);

Try adding this to the bottom of your code

Ruby:
AddChartBubble(BoxHigh != BoxHigh[-1], BoxHigh, BoxHigh, Color.RED);
AddChartBubble(BoxHigh and IsNaN(BoxHigh[-1]), BoxHigh, BoxHigh, Color.RED);

AddChartBubble(BoxHigh1 != BoxHigh1[-1], BoxHigh1, BoxHigh1, Color.RED);
AddChartBubble(BoxHigh1 and IsNaN(BoxHigh1[-1]), BoxHigh1, BoxHigh1, Color.RED);

AddChartBubble(BoxLow != BoxLow[-1], BoxLow, BoxLow, Color.GREEN, no);
AddChartBubble(BoxLow1 != BoxLow1[-1], BoxLow1, BoxLow1, Color.GREEN, no);

AddChartBubble(BoxLow and IsNaN(BoxLow[-1]), BoxLow, BoxLow, Color.GREEN, no);
AddChartBubble(BoxLow1 and IsNaN(BoxLow1[-1]), BoxLow1, BoxLow1, Color.GREEN, no);
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
279 Online
Create Post

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