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.
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: