How to add Ding sound to RSI indicator

Carlo592

New member
VIP
Hi All, I have a hopefully pretty simple help needed request. So for the standard ToS RSI, when it crosses over like in the pictures below, I'd like to have it make a ding sound.
Thanks to anyone who tries to help!
1743377182701.png


1743377200324.png


I tried to add it myself first, it doesn't throw up any errors but it doesn't work either, I feel that I must be missing some code I need to add. The last two lines pasted below are what I have added.

#

# Charles Schwab & Co. (c) 2007-2025

#



declare lower;



input length = 14;

input over_Bought = 70;

input over_Sold = 30;

input price = close;

input averageType = AverageType.WILDERS;

input showBreakoutSignals = no;



def NetChgAvg = MovingAverage(averageType, price - price[1], length);

def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);

def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;



plot RSI = 50 * (ChgRatio + 1);

plot OverSold = over_Sold;

plot OverBought = over_Bought;

plot UpSignal = if RSI crosses above OverSold then OverSold else Double.NaN;

plot DownSignal = if RSI crosses below OverBought then OverBought else Double.NaN;



UpSignal.SetHiding(!showBreakoutSignals);

DownSignal.SetHiding(!showBreakoutSignals);



RSI.DefineColor("OverBought", GetColor(5));

RSI.DefineColor("Normal", GetColor(7));

RSI.DefineColor("OverSold", GetColor(1));

RSI.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal"));

OverSold.SetDefaultColor(GetColor(8));

OverBought.SetDefaultColor(GetColor(8));

UpSignal.SetDefaultColor(Color.UPTICK);

UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);

DownSignal.SetDefaultColor(Color.DOWNTICK);

DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

Alert(Upsignal, Sound.Ding);

Alert(Downsignal, Sound.Ding);
 
Hi All, I have a hopefully pretty simple help needed request. So for the standard ToS RSI, when it crosses over like in the pictures below, I'd like to have it make a ding sound.
Thanks to anyone who tries to help!
View attachment 24436

View attachment 24437

I tried to add it myself first, it doesn't throw up any errors but it doesn't work either, I feel that I must be missing some code I need to add. The last two lines pasted below are what I have added.

#

# Charles Schwab & Co. (c) 2007-2025

#



declare lower;



input length = 14;

input over_Bought = 70;

input over_Sold = 30;

input price = close;

input averageType = AverageType.WILDERS;

input showBreakoutSignals = no;



def NetChgAvg = MovingAverage(averageType, price - price[1], length);

def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);

def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;



plot RSI = 50 * (ChgRatio + 1);

plot OverSold = over_Sold;

plot OverBought = over_Bought;

plot UpSignal = if RSI crosses above OverSold then OverSold else Double.NaN;

plot DownSignal = if RSI crosses below OverBought then OverBought else Double.NaN;



UpSignal.SetHiding(!showBreakoutSignals);

DownSignal.SetHiding(!showBreakoutSignals);



RSI.DefineColor("OverBought", GetColor(5));

RSI.DefineColor("Normal", GetColor(7));

RSI.DefineColor("OverSold", GetColor(1));

RSI.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal"));

OverSold.SetDefaultColor(GetColor(8));

OverBought.SetDefaultColor(GetColor(8));

UpSignal.SetDefaultColor(Color.UPTICK);

UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);

DownSignal.SetDefaultColor(Color.DOWNTICK);

DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

Alert(Upsignal, Sound.Ding);

Alert(Downsignal, Sound.Ding);

you are using 2 input parameters.
but your 2nd parameter (ding) is not the 2nd input parameter, it is the 4th.
you did not include the input parameter names.
so, sound.ding is assigned to the input 'text' , not 'sound'

without parameter names. setting all 4
alert( Upsignal , "crossed up" , alert.BAR , sound.DING );

or

with parameter names, setting just 2 non sequencial parameters
alert( condition = Upsignal , sound = sound.DING );

https://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Others/Alert
Alert ( condition , text , alert type , sound );
 

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