IF it can't be made into a complete watchlist item can it just contain the buy/sell for the 9 with green color for buy and red sell?
declare upper;
def buy= SequenceCounter();
def sell= SequenceCounter()."Sell Array";
def buy_9 = SequenceCounter()."Buy Formation";
def sell_9 = SequenceCounter()."Sell Formation";
def xSELL=sell==13;
def xBUY =buy==13;
def ybuy = buy_9 ==9;
def ysell = sell_9==9;
Alert(xSELL,"SELL Array=13",Alert.BAR,Sound.Chimes);
Alert(xBUY,"BUY Array =13",Alert.BAR,Sound.Chimes);
Alert(ySELL,"SELL Formation=9",Alert.BAR,Sound.Chimes);
Alert(yBUY,"BUY Formation =9",Alert.BAR,Sound.Chimes);
unfortunetely, this can't be changed to a watchlist study. it is too complex.
--------------------------
to make a watchlist study,
start by copying the code and make a lower chart study.
that way you can add bubbles and labels, to see things and verify values.
after you get all the formulas working, disable all the outputs (plots, labels, bubbles,..) and set up just 1 label to display the words you have in your alerts.
-------------------------
look up the main function
https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/R-S/SequenceCounter
the first plot is the one used in your 3rd formula. so in your first formula, by not specifying a plot formula, buy will be the same as buy_9.
this is missing a plot name
def buy = SequenceCounter();
based on the 2nd formula, i guessed it should be like this,
def buy = SequenceCounter()."buy array";
i added plots to plot some values
i added a bubble to display values.
there are many values at N/A. so it may be best to look for N/A values and change them to something else, like 0.
i changed/added some formulas so some variables have different names. see below for the complete lower study.
test code i added, to see values,
Code:
input test2 = no;
addchartbubble(test2, 0,
buyb + "\n" +
sellb + "\n" +
buy_9b + "\n" +
sell_9b + "\n\n" +
xbuy + "\n" +
xsell + "\n" +
ybuy + "\n" +
ysell + "\n\n" +
(if xBUY then "BUY\nArray=13"
else if xSELL then "SELL\nArray=13"
else if yBUY then "BUY\nFormation=9"
else if ySELL then "SELL\nFormation=9"
else "-"),
color.yellow, no);
plot z1 = xbuy;
plot z2 = xsell;
plot z3 = ybuy;
plot z4 = ysell;
plot s1 = buyb;
plot s2 = sellb;
plot s3 = buy_9b;
plot s4 = sell_9b;
#
lower study , bubbles with values
------------------------------
complete lower study,
Code:
# make_col_seq_00lower
#https://usethinkscript.com/threads/how-do-i-make-this-into-a-watchlist.14222/
#How do I make this into a watchlist?
declare lower;
def buy = SequenceCounter()."buy array";
def sell = SequenceCounter()."Sell Array";
def buy_9 = SequenceCounter()."Buy Formation";
def sell_9 = SequenceCounter()."Sell Formation";
def buyb = if isnan(buy) then 0 else buy;
def sellb = if isnan(sell) then 0 else sell;
def buy_9b = if isnan(buy_9) then 0 else buy_9;
def sell_9b = if isnan(sell_9) then 0 else sell_9;
def xSELL = sellb == 13;
def xBUY = buyb == 13;
def ybuy = buy_9b == 9;
def ysell = sell_9b == 9;
addlabel(1,
(if xBUY then "BUY Array =13"
else if xSELL then "SELL Array=13"
else if yBUY then "BUY Formation =9"
else if ySELL then "SELL Formation=9"
else "-"),
(if xBUY then color.green
else if xSELL then color.red
else if yBUY then color.cyan
else if ySELL then color.yellow
else color.gray));
def t = xBUY or xSELL or yBUY or ySELL;
input test1 = yes;
addchartbubble(test1 and t, 0,
(if xBUY then "BUY\nArray=13"
else if xSELL then "SELL\nArray=13"
else if yBUY then "BUY\nFormation=9"
else if ySELL then "SELL\nFormation=9"
else "-"),
color.yellow, no);
input test2 = no;
addchartbubble(test2, 0,
buyb + "\n" +
sellb + "\n" +
buy_9b + "\n" +
sell_9b + "\n\n" +
xbuy + "\n" +
xsell + "\n" +
ybuy + "\n" +
ysell + "\n\n" +
(if xBUY then "BUY\nArray=13"
else if xSELL then "SELL\nArray=13"
else if yBUY then "BUY\nFormation=9"
else if ySELL then "SELL\nFormation=9"
else "-"),
color.yellow, no);
#(if xBUY then color.green
#else if xSELL then color.red
#else if yBUY then color.cyan
#else if ySELL then color.yellow
#else color.gray), no);
plot z1 = xbuy;
plot z2 = xsell;
plot z3 = ybuy;
plot z4 = ysell;
plot s1 = buyb;
plot s2 = sellb;
plot s3 = buy_9b;
plot s4 = sell_9b;
Alert(xSELL,"SELL Array=13",Alert.BAR,Sound.Chimes);
Alert(xBUY,"BUY Array =13",Alert.BAR,Sound.Chimes);
Alert(ySELL,"SELL Formation=9",Alert.BAR,Sound.Chimes);
Alert(yBUY,"BUY Formation =9",Alert.BAR,Sound.Chimes);
#
----------------------------------
watchlist - column study
copy lower study
disable all the outputs ( plots, labels, bubbles, alerts,..)
create a new label with desired text
add formula to change background color
here is a study for a watchlist, but, it is too complex to run. OK is disabled, can't run it.
i copied the code to a text file.
i had column time set to 5 minutes.
Code:
# zseqnum
# make_col_seq_00lower
#https://usethinkscript.com/threads/how-do-i-make-this-into-a-watchlist.14222/
#How do I make this into a watchlist?
#FreefallJM03 1/27
#IF it can't be made into a complete watchlist item can it just contain the buy/sell for the 9 with green color for buy and red sell?
#declare lower;
def buy = SequenceCounter()."buy array";
def sell = SequenceCounter()."Sell Array";
def buy_9 = SequenceCounter()."Buy Formation";
def sell_9 = SequenceCounter()."Sell Formation";
def buyb = if isnan(buy) then 0 else buy;
def sellb = if isnan(sell) then 0 else sell;
def buy_9b = if isnan(buy_9) then 0 else buy_9;
def sell_9b = if isnan(sell_9) then 0 else sell_9;
def xSELL = sellb == 13;
def xBUY = buyb == 13;
def ybuy = buy_9b == 9;
def ysell = sell_9b == 9;
addlabel(1,
(if xBUY then "BUY Array=13"
else if xSELL then "SELL Array=13"
else if yBUY then "BUY Formation=9"
else if ySELL then "SELL Formation=9"
else "-"), color.black);
AssignBackgroundColor(
(if xBUY then color.green
else if xSELL then color.red
else if yBUY then color.cyan
else if ySELL then color.yellow
else color.gray));
#
--------------------------------
with all 4 variables left in tact, the study is too complex to be used in a watchlist.
i had to disable 3 of the 4 variables, that read from SequenceCounter(),
then it allowed me to save it as a watchlist study.
#def buy = SequenceCounter()."buy array";
#def sell = SequenceCounter()."Sell Array";
def buy_9 = SequenceCounter()."Buy Formation";
#def sell_9 = SequenceCounter()."Sell Formation";
in a watchlist study, you set the label or plot color to black.
then change the background color with AssignBackgroundColor( )
Code:
# zseqnum
# make_col_seq_00lower
#https://usethinkscript.com/threads/how-do-i-make-this-into-a-watchlist.14222/
#How do I make this into a watchlist?
#FreefallJM03 1/27
#IF it can't be made into a complete watchlist item can it just contain the buy/sell for the 9 with green color for buy and red sell?
#declare lower;
#def buy = SequenceCounter()."buy array";
#def sell = SequenceCounter()."Sell Array";
def buy_9 = SequenceCounter()."Buy Formation";
#def sell_9 = SequenceCounter()."Sell Formation";
#def buyb = if isnan(buy) then 0 else buy;
#def sellb = if isnan(sell) then 0 else sell;
def buy_9b = if isnan(buy_9) then 0 else buy_9;
#def sell_9b = if isnan(sell_9) then 0 else sell_9;
#def xSELL = sellb == 13;
#def xBUY = buyb == 13;
def ybuy = buy_9b == 9;
#def ysell = sell_9b == 9;
addlabel(1,
(
#if xBUY then "BUY Array=13"
#else if xSELL then "SELL Array=13"
#else
if yBUY then "BUY Formation=9"
#else if ySELL then "SELL Formation=9"
else "-"), color.black);
AssignBackgroundColor(
(
#if xBUY then color.green
#else if xSELL then color.red
#else
if yBUY then color.cyan
#else if ySELL then color.yellow
else color.gray));
#
https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Look---Feel/AssignBackgroundColor