How do I make this into a watchlist?

FreefallJM03

Member
VIP
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);
 
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
TdLXH65.jpg



------------------------------



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);
#
j3FNHvn.jpg



----------------------------------


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
 

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