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