Why Won't My Bubble Plot?

greco26

Active member
HI All, Any idea why my bubble for SignalDLBN isn't plotting? The bar with the pink circle is the one I want. Thanks as always!

AddChartBubble( bn == SignalDLBN, low, "The One I Want", Color.white,no);



Code:
#######################################################################################################

#PIVOT SECTION

input LBPeriod = 10;
def bn = barnumber();

def agg15 = getaggregationperiod();
def HH15 = Highest(high(Period = agg15), LBPeriod);
def marketHigh15 = if HH15 > HH15[-LBPeriod] then HH15 else HH15[-LBPeriod];
def markedHigh15 = high(Period = agg15) == marketHigh15;
def PivotHigh15 = CompoundValue(1, if IsNaN( markedHigh15) then PivotHigh15[1] else if markedHigh15 then high(Period = agg15) else PivotHigh15[1], high(Period = agg15));
def LastPivotHigh15 = if PivotHigh15 != PivotHigh15[1] then PivotHigh15[1] else LastPivotHigh15[1];
#-------------------------------------------------------------
plot PH = PivotHigh15;
#--------------------------------------------------------------
def LL15 = Lowest(low(Period = agg15), LBPeriod);
#--------------------------------------------------------------
def marketLow15 = if LL15 < LL15[-LBPeriod] then LL15 else LL15[-LBPeriod];
def markedLow15 = low(Period = agg15) == marketLow15;
def PivotLow15 = CompoundValue(1, if IsNaN(markedLow15) then PivotLow15[1] else if markedLow15 then low(Period = agg15) else PivotLow15[1], low(Period = agg15));
#-------------------------------------------------------------
plot PL = PivotLow15 ;
#-------------------------------------------------------------
#--------------------------------------------------------------
PH.SetPaintingStrategy(PaintingStrategy.POINTS);
PH.SetDefaultColor(Color.Light_GREEN);
PH.Setlineweight(3);

#--------------------------------------------------------------
PL.SetPaintingStrategy(PaintingStrategy.POINTS);
PL.SetDefaultColor(Color.PINK);
PL.Setlineweight(3);

##SHORT

def PHCount = if bn == 1 then 0 else if high == ph then PHCount[1] + 1 else PHCount[1];
def PHCountMax = HighestAll(PHCount);
def PHRevCount = PHCountMax - PHCount + 1;

def LastPHBN = if PHRevCount == 2 and PHRevCount[1] == 3 then bn else LastPHBN[1];
def LastPHPrice = if bn == LastPHBN then high else LastPHPrice[1];
def LastPHCross = if  high crosses above LastPHPrice then bn else LastPHCross[1];
def HighestCross = highestall(LastPHCross);



def BnPastCross = bn >= HighestCross;
def highesthi = if  BnPastCross and high == highest(high) then bn else highesthi[1];
def Hightsthibn = highestall(highesthi);
AddChartBubble( bn==Hightsthibn, high, "HH", Color.yellow);


def DispLowbn = if low < low[1] and low < low[-1] then bn else 0 ;
def HighestDispLowBn = highestall(DispLowbn);
def SignalDLBN = if bn > Hightsthibn then 0 else HighestDispLowBn;


AddChartBubble( bn == DispLowbn, low, "All DL BN's", Color.RED,no);
AddChartBubble( bn == SignalDLBN, low, "The One I Want", Color.white,no);
 

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

@greco26
Add this after the definition line of 'SignalDLBN':
Ruby:
#Counter that increments by 1 every time bn == DispLowbn up until Highest High.
def HBNC;
if bn == Hightsthibn { #Set counter to zero (disable). (Zero is used as a flag to stop counting when "HH" label is plotted and remain zero after.)
HBNC = 0;
} else if bn == 0 { #Start counter at one on first bar of chart.
HBNC = 1;
} else if HBNC[1] <> 0 and bn == DispLowbn { #Increment by 1 every time 'DispLowbn is not zero' and counter is not disabled (set to zero).
HBNC = HBNC[1] + 1;
} else {
HBNC = HBNC[1]; }

and change the addchartbubble line to this:
Ruby:
AddChartBubble(HBNC == HighestAll(HBNC) and DispLowbn <> 0, low, "The One I Want", Color.white,no);
#Display bubble if at highest counter value where 'DispLowbn is also not zero.

 
Last edited:
This worked great!! I dont know why your code worked or really what my issue was to begin with. I know this is a lot to ask and dont worry if you dont have time but can you annotate what each step of your code is doing so that I can learn how to do it correctly the next time? Again, no worries if you can't. Thank you SOO much as always!!
 
@greco26 Annotated above code.
Your biggest issue was there was not a way to signal where the highest high was in relation to the rest of the chart.

After thinking more about it, your original code could accomplish the same thing by changing the definition of 'DispLowbn' to:
Ruby:
def DispLowbn = if low < low[1] and low < low[-1] and bn < Hightsthibn then bn else 0 ;
but you would also lose any plots of 'DispLowbn' after the highest high.
 
Last edited:
HI All, Any idea why my bubble for SignalDLBN isn't plotting? The bar with the pink circle is the one I want. Thanks as always!

AddChartBubble( bn == SignalDLBN, low, "The One I Want", Color.white,no);



Code:
#######################################################################################################

#PIVOT SECTION

input LBPeriod = 10;
def bn = barnumber();

def agg15 = getaggregationperiod();
def HH15 = Highest(high(Period = agg15), LBPeriod);
def marketHigh15 = if HH15 > HH15[-LBPeriod] then HH15 else HH15[-LBPeriod];
def markedHigh15 = high(Period = agg15) == marketHigh15;
def PivotHigh15 = CompoundValue(1, if IsNaN( markedHigh15) then PivotHigh15[1] else if markedHigh15 then high(Period = agg15) else PivotHigh15[1], high(Period = agg15));
def LastPivotHigh15 = if PivotHigh15 != PivotHigh15[1] then PivotHigh15[1] else LastPivotHigh15[1];
#-------------------------------------------------------------
plot PH = PivotHigh15;
#--------------------------------------------------------------
def LL15 = Lowest(low(Period = agg15), LBPeriod);
#--------------------------------------------------------------
def marketLow15 = if LL15 < LL15[-LBPeriod] then LL15 else LL15[-LBPeriod];
def markedLow15 = low(Period = agg15) == marketLow15;
def PivotLow15 = CompoundValue(1, if IsNaN(markedLow15) then PivotLow15[1] else if markedLow15 then low(Period = agg15) else PivotLow15[1], low(Period = agg15));
#-------------------------------------------------------------
plot PL = PivotLow15 ;
#-------------------------------------------------------------
#--------------------------------------------------------------
PH.SetPaintingStrategy(PaintingStrategy.POINTS);
PH.SetDefaultColor(Color.Light_GREEN);
PH.Setlineweight(3);

#--------------------------------------------------------------
PL.SetPaintingStrategy(PaintingStrategy.POINTS);
PL.SetDefaultColor(Color.PINK);
PL.Setlineweight(3);

##SHORT

def PHCount = if bn == 1 then 0 else if high == ph then PHCount[1] + 1 else PHCount[1];
def PHCountMax = HighestAll(PHCount);
def PHRevCount = PHCountMax - PHCount + 1;

def LastPHBN = if PHRevCount == 2 and PHRevCount[1] == 3 then bn else LastPHBN[1];
def LastPHPrice = if bn == LastPHBN then high else LastPHPrice[1];
def LastPHCross = if  high crosses above LastPHPrice then bn else LastPHCross[1];
def HighestCross = highestall(LastPHCross);



def BnPastCross = bn >= HighestCross;
def highesthi = if  BnPastCross and high == highest(high) then bn else highesthi[1];
def Hightsthibn = highestall(highesthi);
AddChartBubble( bn==Hightsthibn, high, "HH", Color.yellow);


def DispLowbn = if low < low[1] and low < low[-1] then bn else 0 ;
def HighestDispLowBn = highestall(DispLowbn);
def SignalDLBN = if bn > Hightsthibn then 0 else HighestDispLowBn;


AddChartBubble( bn == DispLowbn, low, "All DL BN's", Color.RED,no);
AddChartBubble( bn == SignalDLBN, low, "The One I Want", Color.white,no);
How can a scan be created for highest PH and lowest PL? Thanks
 
HI All, Any idea why my bubble for SignalDLBN isn't plotting? The bar with the pink circle is the one I want. Thanks as always!

AddChartBubble( bn == SignalDLBN, low, "The One I Want", Color.white,no);



Code:
#######################################################################################################

#PIVOT SECTION

input LBPeriod = 10;
def bn = barnumber();

def agg15 = getaggregationperiod();
def HH15 = Highest(high(Period = agg15), LBPeriod);
def marketHigh15 = if HH15 > HH15[-LBPeriod] then HH15 else HH15[-LBPeriod];
def markedHigh15 = high(Period = agg15) == marketHigh15;
def PivotHigh15 = CompoundValue(1, if IsNaN( markedHigh15) then PivotHigh15[1] else if markedHigh15 then high(Period = agg15) else PivotHigh15[1], high(Period = agg15));
def LastPivotHigh15 = if PivotHigh15 != PivotHigh15[1] then PivotHigh15[1] else LastPivotHigh15[1];
#-------------------------------------------------------------
plot PH = PivotHigh15;
#--------------------------------------------------------------
def LL15 = Lowest(low(Period = agg15), LBPeriod);
#--------------------------------------------------------------
def marketLow15 = if LL15 < LL15[-LBPeriod] then LL15 else LL15[-LBPeriod];
def markedLow15 = low(Period = agg15) == marketLow15;
def PivotLow15 = CompoundValue(1, if IsNaN(markedLow15) then PivotLow15[1] else if markedLow15 then low(Period = agg15) else PivotLow15[1], low(Period = agg15));
#-------------------------------------------------------------
plot PL = PivotLow15 ;
#-------------------------------------------------------------
#--------------------------------------------------------------
PH.SetPaintingStrategy(PaintingStrategy.POINTS);
PH.SetDefaultColor(Color.Light_GREEN);
PH.Setlineweight(3);

#--------------------------------------------------------------
PL.SetPaintingStrategy(PaintingStrategy.POINTS);
PL.SetDefaultColor(Color.PINK);
PL.Setlineweight(3);

##SHORT

def PHCount = if bn == 1 then 0 else if high == ph then PHCount[1] + 1 else PHCount[1];
def PHCountMax = HighestAll(PHCount);
def PHRevCount = PHCountMax - PHCount + 1;

def LastPHBN = if PHRevCount == 2 and PHRevCount[1] == 3 then bn else LastPHBN[1];
def LastPHPrice = if bn == LastPHBN then high else LastPHPrice[1];
def LastPHCross = if  high crosses above LastPHPrice then bn else LastPHCross[1];
def HighestCross = highestall(LastPHCross);



def BnPastCross = bn >= HighestCross;
def highesthi = if  BnPastCross and high == highest(high) then bn else highesthi[1];
def Hightsthibn = highestall(highesthi);
AddChartBubble( bn==Hightsthibn, high, "HH", Color.yellow);


def DispLowbn = if low < low[1] and low < low[-1] then bn else 0 ;
def HighestDispLowBn = highestall(DispLowbn);
def SignalDLBN = if bn > Hightsthibn then 0 else HighestDispLowBn;


AddChartBubble( bn == DispLowbn, low, "All DL BN's", Color.RED,no);
AddChartBubble( bn == SignalDLBN, low, "The One I Want", Color.white,no);
Can you please help to provide the scripts for addchartbubble for "LL""
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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