Watchlists and coding question

SethW446

New member
VIP
I found a watchlist column called zemacross
https://usethinkscript.com/threads/ema5-crosses-ema13-watchlist.19690/#post-147469
which I like and would like to doctor it some. How do I find other watchlist columns like this, searching in studies was not fruitful.
And how do I get my column into the list of potential columns? I am looking at a list of posts as I type, so this problem is my not knowing TOS as well as I need to. The coding problem is that the label doesn't post what I want it to, and I don't understand. It posts the first half of what I want but not the second half, Xup1 but not Xup2, same with Xdn.
I would love to get this workiing, but more, to understand what I needed to do to make it work. Thanks in advance.
Code:
##EMA5 Crosses EMA13 Watchlist - concat

# copy of Ema5 - 13
# ema5_crosses_ema13_lower

#https://usethinkscript.com/threads/ema5-crosses-ema13-watchlist.19690/
#EMA5 Crosses EMA13 Watchlist - concat

def na = Double.NaN;
def bn = BarNumber();
def data = close;

input avg1_type = AverageType.EXPONENTIAL;
input avg1_length = 5;
def avg1 = MovingAverage(avg1_type, data, avg1_length );

input avg2_type = AverageType.EXPONENTIAL;
input avg2_length = 13;
def avg2 = MovingAverage(avg2_type, data, avg2_length );

input show_avg1_line = yes;
input show_avg2_line = yes;

#def xup = avg1 crosses above avg2;
#def xdwn = avg1 crosses below avg2;
def xup1 = close > avg1;
def xup2 = close > avg1 and avg2;
def xdn1 = close < avg1;
def xdn2 = close < avg1 and avg2;

addlabel(1,
(if xup1 then "Xup1" else if xup1 and xup2 then "Xup2" else if xdn1 then "Xdn1" else if xdn1 and xdn2 then "Xdn2" else "-")
, color.black);

AssignBackgroundColor(if xup1 or xup1 and xup2 then color.green else if xdn1 or xdn1 and xdn2 then color.red else color.gray);
 
Last edited by a moderator:
Solution
i added a link to your post.
if you click on a post number, in the top right corner, the page will reload with a URL that will take you to that post.

here is a video that talks about watchlists and marketwatch lists.
jump to 1:50 to see about adding a study
https://www.schwab.com/learn/story/create-and-customize-watchlists-on-thinkorswim

not sure what you are trying to do....
but , your logic is flawed.

these will have the same outputs. avg2 is a number, that is > 0 , so it will always be true, so xup1 will always be the same as xup2.
def xup1 = close > avg1;
def xup2 = close > avg1 and avg2;

what are you trying to do?
i added a link to your post.
if you click on a post number, in the top right corner, the page will reload with a URL that will take you to that post.

here is a video that talks about watchlists and marketwatch lists.
jump to 1:50 to see about adding a study
https://www.schwab.com/learn/story/create-and-customize-watchlists-on-thinkorswim

not sure what you are trying to do....
but , your logic is flawed.

these will have the same outputs. avg2 is a number, that is > 0 , so it will always be true, so xup1 will always be the same as xup2.
def xup1 = close > avg1;
def xup2 = close > avg1 and avg2;

what are you trying to do?
 
Last edited by a moderator:
Solution

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Great! Thanks for the help. They are both numbers but one can be below Price while the other is not. And what I want to know is if one or both is below price, one or both are above price. But I do see your point, and I don't see how to distinguish them. Perhaps a count of how many periods since xup1 switched from above price to below price, and how long ago did both become below price, a momentum measure, perhaps. In fact, the background color would tell above/below, then one count for xup1 and a second for xup2, etc. I think that means potentially 2 colors in a small space. What I thought I was accomplishing was to find the spot where up became down for both MAs separately, so spotting a bounce or trend. I hope I'm clearer.
 
I watched the video you directed me to. I noted around 2 mins in that the narrator said that I could pick watchlist columns from the column list: "All of the possible column choices appear in the Available Items list".
The zemacross item was one I found and added to that items list, so it must be possible to add some. How? I'll hunt for that zemacross thread, thanks.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
170 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