SSL Indicator For ThinkorSwim

I think I got it sorted with the Invalid Statements thing... figured out there was a "then" missing in there. All good now, except now its saying "Exactly one plot expected" and won't allow me to save it. Any ideas??

you are trying to make a watchlist study , right?
so there is no chart, just 1 cell, like in excel, for displaying 1 variable value . 1.

plot and addlabel are outputs.
you have 3 plots and 1 label
which ONE of them has the data you want to see in the list?

change all 3 plots to def. replace the word plot with def.
disable the plot characteristic code lines by adding a # at the front of them ,
painting strategy, lineweight, color,...


these won't display in a watch list,
arrows, lines, bubbles, assert, assignpricecolor , ,....
your study has a lot of code lines that have no purpose in a watch list, so they should be removed, or disabled by adding a # at the front of the code lines.

you don't need to write out 'is true' if the variable is a true or false value ( 0 or 1). just use the variable itself as the condition.


a cleaned up version

Code:
# ssl_ch_00_upper
#also gannhilow
#https://www.tradingview.com/script/xzIoaIJC-SSL-channel/

#declare upper;
#input period = 8;
input length = 8;
input avgType = averageType.simple;
def avgHigh = movingAverage(avgType, high, length);
def avgLow = movingAverage(avgType, low, length);;

def H1v = if isnan(close[1]) then 0
 else if close > avghigh then 1
 else if close < avgLow then -1
 else H1v[1];


#plot sslDown= if h1v<0 then avghigh else avglow;
def sslDown = if h1v < 0 then avghigh else avglow;
#ssldown.setDefaultColor(color.red);

#plot sslUp= if h1v<0 then avgLow else avghigh;
def sslUp = if h1v < 0 then avgLow else avghigh;
#sslUP.setDefaultColor(color.green);
#addcloud(sslup,ssldown,color.dark_green,color.red);

#plot UpSigna = if sslUp crosses above sslDown then sslDown else Double.NaN;
def UpSigna = if sslUp crosses above sslDown then sslDown else Double.NaN;
#UpSigna.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
#UpSigna.SetLineWeight(1);
#UpSigna.SetDefaultColor(Color.GREEN);

#plot DownSigna = if sslUp crosses below sslDown then sslDown else Double.NaN;
def DownSigna = if sslUp crosses below sslDown then sslDown else Double.NaN;
#DownSigna.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
#DownSigna.SetLineWeight(1);
#DownSigna.SetDefaultColor(Color.RED);

#Alert(sslUp crosses above sslDown, "Trending Up", Alert.Bar, Sound.Bell);
#Alert(sslUp crosses below sslDown, "Trending Down", Alert.Bar, Sound.Ring);

#input colorbars = no;
#assignpricecolor(if colorbars and sslUP > ssldown then color.Green else if colorbars and ssldown > sslUP then color.Red else color.current);

#Addlabel(yes, if Upsigna is true then “ “ else if downsigna is true “ “ else “ “);
Addlabel(yes, “ “, color.blue);

#AssignBackgroundColor(if upsigna is true then color.green else if downsigna is true color.red else color.gray);
AssignBackgroundColor(if upsigna then color.green else if downsigna then color.red else color.gray);
#


nit picking ,
you are using the word period instead of length , for the length of an average
 
Outstanding, thanks everyone! Works like a charm now. I would have spent the better part of my natural life trying to figure that all out. I don't know enough to code, but adding colors to watchlists seems pretty basic, right? Guess not! Thanks again.
 
Well, here's a bummer... after installing the custom quote code per this thread to color the background cell for SSL indicator signals, it failed its first real test! It doesn't seem to work. After last week, there were a number of stocks that triggered to the downside, but no joy... no cell backgrounds colored red.
Can anyone re-look at the code provided here and give me some clue as to what's wrong? https://usethinkscript.com/threads/ssl-indicator-for-thinkorswim.299/post-121312
 
Well, here's a bummer... after installing the custom quote code per this thread to color the background cell for SSL indicator signals, it failed its first real test! It doesn't seem to work. After last week, there were a number of stocks that triggered to the downside, but no joy... no cell backgrounds colored red.
Can anyone re-look at the code provided here and give me some clue as to what's wrong? https://usethinkscript.com/threads/ssl-indicator-for-thinkorswim.299/post-121312
Sorry, there were no syntax errors in this script.
The most common error that members make is setting the watchlist to a different timeframe than your chart.
https://tlc.thinkorswim.com/center/howToTos/thinkManual/MarketWatch/Quotes/customquotes#:~:text=set using the-,Aggregation,-list. Also, make

The only other way you are seeing missed signals, would be because this watchlist script is not the same as your signals script.

You would need to provide a shared chart link with the chart containing the signal and the watchlist that doesn't.

If you're unsure of how to share chart links or upload screenshots to the forum, don't worry, we've included some easy-to-follow directions for you.
How to create a shared chart link:
https://usethinkscript.com/threads/how-to-share-a-chart-in-thinkorswim.14221/
How to upload screenshots to the forum:
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/#post-58714

Shared Watchlist Script Code: http://tos.mx/jZCQoGO Click here for --> Easiest way to load shared links
VPivXJY.png

Ruby:
# ssl_ch_00_upper
#also gannhilow
#https://www.tradingview.com/script/xzIoaIJC-SSL-channel/

input length = 8;
input avgType = averageType.simple;
def avgHigh = movingAverage(avgType, high, length);
def avgLow = movingAverage(avgType, low, length);;

def H1v = if isnan(close[1]) then 0
 else if close > avghigh then 1
 else if close < avgLow then -1
 else H1v[1];

def sslDown = if h1v < 0 then avghigh else avglow;
def sslUp = if h1v < 0 then avgLow else avghigh;

def UpSigna = sslUp crosses above sslDown ;
def DownSigna =  sslUp crosses below sslDown;

Addlabel(yes, “ “);
AssignBackgroundColor(if upsigna then color.green else if downsigna then color.red else color.gray);
 
Last edited:
I have been using the SSL channel 48 ema with the 13 ema.
When the 13 ema crosses outside the channel, I look for a candle pull back and rejection, then buy
It keeps me out of some chop and the emas start to separate more after the break.
Is there a way to get an alert to my phone when it crosses above or below the channel.
 

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