Addchartbubble not Showing on chart

british43

Member
VIP
I'm not sure what I'm doing wrong but my bubbles are not showing. Can someone please assist thanks.

Code:
declare lower;
input price = close;

def "4%Model" = reference ZigZagPercent(price,10)."ZZ%";
#plot t= "4%Model"*.002;
plot t= "4%Model";
t.SetDefaultColor(GetColor(8));
t.EnableApproximation();

input length = 200;
input length1 = 10;
input displace = 0;
input showBreakoutSignals = no;

#plot AvgExp = ExpAverage(price[-displace], length);
#plot AvgExp1 = ExpAverage(price[-displace], length1);

input displace1 = -5;
input length2 = 16;

plot LowerBand = Lowest(low[-displace1 + 1], length2);
LowerBand.SetDefaultColor(color.yellow);

plot UpperBand = Highest(high[-displace1 + 1], length2);
UpperBand.SetDefaultColor(Color.cyan);

AddChartBubble(t crosses upperband, upperband, "SE", Color.red, no);

AddChartBubble(t crosses lowerBand, lowerband, "LE", Color.green, yes);
 
because your probably didn't define correctly what you want the bubble to show, and you didn't explain to us what you want the bubble to show.
 
I saw what I was doing wrong. Thanks. Is there a way to add date and time in a bubble when EMAs crosses?
You may find this helpful. It does not work on all timeframes as noted in script header.
2021-03-07-TOS-CHARTS.png
Code:
#Example EMA Cross Time Happened
#20171217 Sleepz modified  20210307
#Times seem to work on most intraday rth aggs currently except 4m, 20m and 1hr

input timezone  = {default "ET", "CT", "MT", "PT"};
input rthbegin  = 0930;
input rthend    = 1600;
input labels    = yes;
input timebubbles   = yes;
input datebubbles   = yes;

def CountActive = if SecondsTillTime(rthend) > 0 and SecondsFromTime(rthbegin) >= 0 then 1 else 0;
def StartBar    = if SecondsFromTime(rthbegin) >= 0 and SecondsFromTime(rthbegin) < 2 then 1 else 0;
def BarStart    = if StartBar then BarNumber() else BarStart[1];
def BarCount    = if CountActive then BarNumber() - BarStart else Double.NaN;
def timehr      = if  (GetAggregationPeriod() / 60000 == 4 or GetAggregationPeriod() / 60000 == 20 or GetAggregationPeriod() / 60000 == 60)
                  then Double.NaN
                  else (if timezone == timezone."ET"
                        then 9
                        else if timezone == timezone."CT"
                        then 8
                        else if timezone == timezone."MT"
                        then 7
                        else 6) +
                 Round(BarCount / (60 / (GetAggregationPeriod() / 60000)) , 0);
def timemin    = Round(60 * (.5 + (BarCount / 60 * GetAggregationPeriod() / 60000 - (Round(BarCount / 60 * GetAggregationPeriod() / 60000, 0)))), 0);

plot ema1 = ExpAverage(length = 8,  data = close);
plot ema2 = ExpAverage(length = 13, data = close);

def  cond = if Crosses(data1 = ema1, data2 = ema2) then 1 else 0;
def cross = if cond == 1 then Round(close) else cross[1];
def hihr  = if CountActive and cond then  timehr else hihr[1];
def himin = if CountActive and cond then  timemin else himin[1];

plot cross_ = if cond == 1 then close else Double.NaN;

AddLabel(labels, "Last RTH EMA Cross" + " " +
           (AsPrice(GetYYYYMMDD())) + " " +
           (hihr + ":") +
           (if himin < 10
            then "0" + himin + " - " + asdollars(cross)
            else  "" + himin + " - " + asdollars(cross)) , if ema1 > ema2 then Color.GREEN else Color.RED);

AddChartBubble(timebubbles and !IsNaN(timehr) and IsNaN(cross_[1]) and cross_, ema1,
               timehr + ":" + if timemin < 10
                              then "0" + timemin + " - " + asdollars(cross)
                              else "" + timemin + " - " + asdollars(cross), if ema1 > ema2 then Color.GREEN else Color.RED, if ema1 > ema2 then no else yes);
AddChartBubble(datebubbles and !IsNaN(timehr) and IsNaN(cross_[1]) and cross_, ema1,
               AsPrice(GetYYYYMMDD()), Color.GRAY, if ema1 > ema2 then no else yes);
 

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
338 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