Anyway to toggle on/off chart bubbles?

rottentrade

Member
Even if I uncheck "show study", the chart bubbles still show up on the chart. Shouldn't they disappear as well?

Instead of modifying the codes to get ride of the bubbles, is there a quick way to turn them on and off from the Studies panel?
 
Solution
I have another question similar to one above. Instead of using a Boolean (yes or no), I would like to use Strings for the Inputs as shown below (Both, Long, Short). But I get an error as shown below when I use a string. Any way to get it to work?

Ux3C6St.jpg


Code:
input Orders = {Default Both, Long, Short};

def Buy = Orders == Long and Close > Close[1];
def Sell = Orders == Short and Close < Close[1];
def Both = Buy or Sell;

Error message:

Wrong type cast: You could not compare this enum variable with this value at 166:12
Expected double
No such variable: Both at 166:22

You can do a switch, including all variables in your input orders.

Or, you can try this which seems to parse

Ruby:
input Orders = {default Both...
This will put it into the Settings screen. You will have to modify the other criteria after the first "and" within the "AddChartBubble" for your own triggers

Code:
input Bubbles_On = Yes;

AddChartBubble(Bubbles_On == Yes and MAshort crosses above MAlong and MAshort > MAshort[1] and MAlong > MAlong[1], low, "  BUY  ", Color.LIME, up = No);
 
This will put it into the Settings screen. You will have to modify the other criteria after the first "and" within the "AddChartBubble" for your own triggers
Cool, that worked. Many thanks!

I also modified a bit by assigning different values (Bubbles1 Bubbles2, Bubbles3...) to different groups of bubbles. I currently have over 30 bubbles in the Strategy. Of course, not all are used at the same time. But this will definitely make it much more convenient. Thanks again.
 
I have another question similar to one above. Instead of using a Boolean (yes or no), I would like to use Strings for the Inputs as shown below (Both, Long, Short). But I get an error as shown below when I use a string. Any way to get it to work?

Ux3C6St.jpg


Code:
input Orders = {Default Both, Long, Short};

def Buy = Orders == Long and Close > Close[1];
def Sell = Orders == Short and Close < Close[1];
def Both = Buy or Sell;

Error message:

Wrong type cast: You could not compare this enum variable with this value at 166:12
Expected double
No such variable: Both at 166:22
 
I have another question similar to one above. Instead of using a Boolean (yes or no), I would like to use Strings for the Inputs as shown below (Both, Long, Short). But I get an error as shown below when I use a string. Any way to get it to work?

Ux3C6St.jpg


Code:
input Orders = {Default Both, Long, Short};

def Buy = Orders == Long and Close > Close[1];
def Sell = Orders == Short and Close < Close[1];
def Both = Buy or Sell;

Error message:

Wrong type cast: You could not compare this enum variable with this value at 166:12
Expected double
No such variable: Both at 166:22

You can do a switch, including all variables in your input orders.

Or, you can try this which seems to parse

Ruby:
input Orders = {default Both, Long, Short};

def Buy  = Orders == Orders.Long and close > close[1];
def Sell = Orders == Orders.Short and close < close[1];
def Both = Buy or Sell;
 
Solution
I believe you need to use the switch function.

https://tlc.thinkorswim.com/center/reference/thinkScript/Reserved-Words/switch

input price = close;
input plot_type = {default SMA, "Red EMA", "Green EMA", WMA};
plot Avg;
switch (plot_type) {
case SMA:
Avg = Average(price);
case WMA:
Avg = wma(price);
default:
Avg = ExpAverage(price);
}
Thx for the reply. Here's what I've done using the suggestion, but still ran into a snag. Not sure what to do.

Code:
##### ENTRY/EXIT #####

def Buy = Close crosses above WMA(Close,20);
def Sell = Close crosses below WMA(Close,20);

input order_type = {default “Long”, “Short”};
def Order;
switch (order_type) {
case Long:
    Order = Buy;
case Short:
    Order = Sell;
}

##### BUY/SELL ORDERS #####

AddOrder(OrderType.BUY_AUTO, order_type == "Long" and Buy, close[0], 1, tickcolor = GetColor(1), arrowcolor = Color.UPTICK);
AddOrder(OrderType.SELL_AUTO, order_type == "Short" and Sell, close[0], 1, tickcolor = GetColor(2), arrowcolor = Color.DOWNTICK);

Error message:

Wrong type cast: You could not compare this enum variable with this value at 17:30
Wrong type cast: You could not compare this enum variable with this value at 18:31
Incompatible parameter: "Long" at 12:5
Expected double
Incompatible parameter: "Short" at 12:5
 

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