Moving Average Crossover Watchlist Column for ThinkorSwim

@Andygray8 Yes, you're looking at the correct script. The EMA crossover column will show green if there is a bullish crossover within the last 5 bars...Red if there is a bearish crossover within the last 5 bars.

The watchlist column does not trigger any alerts. It must have came from one of your indicators.
OK cool. How do I get those columns to show up for the 8ema/20sma script that I've entered?
 
@Andygray8 Look for the following in your script:

Code:
input ema1_len = 10;
input ema2_len = 20;

Change them to your desired lengths.
 
OK so just changing them to ema8 sma20 will get the columns to appear in my watchlist/scanner?

This was the script I used:

Code:
input price = close;
input fastLength = 9;
input slowLength = 20;
input averageType = AverageType.EXPONENTIAL;
input averageType2 = AverageType.SIMPLE;

plot FastMA = MovingAverage(averageType, price, fastLength);
plot SlowMA = MovingAverage(averageType2, price, slowLength);
FastMA.SetDefaultColor(GetColor(1));
SlowMA.SetDefaultColor(GetColor(2));

plot ArrowUp = if FastMA crosses above SlowMA
then low
else double.nan;
ArrowUP.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
ArrowUP.SetLineWeight(3);
ArrowUP.SetDefaultColor(Color.Green);
plot ArrowDN = if FastMA crosses below SlowMA
then high
else double.nan;
ArrowDN.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);
ArrowDN.SetLineWeight(3);
ArrowDN.SetDefaultColor(Color.Red);
Alert(ArrowUp, " ", Alert.Bar, Sound.Chimes);
Alert(ArrowDN, " ", Alert.Bar, Sound.Bell);

AddCloud(FastMA, SlowMA, Color.GREEN, Color.RED);
 
Hey BenTen, I went in and adjusted my lengths and simply swapped out the ema's with sma's where needed. The part I'm wondering about is the definition of average type at the beginning. Copied and pasted into stock list on scanner per Markos video instructions. Didn't see the columns pop up but that could be we aren't in the normal trading session for stocks. Here is what it looks like, any edits or should this hack it?

Code:
declare lower;

input lookback = 5;
input ema1_len = 8;
input sma1_len = 20;
input averageType = AverageType.EXPONENTIAL;

def ema1 = MovAvgExponential(length=ema1_len);
def sma1 = simpleMovingAvg(length=sma1_len);

def bull_cross = ema1 crosses above sma1;
def bear_cross = ema1 crosses below sma1;

def bull_lookback = highest(bull_cross, lookback);
def bear_lookback = highest(bear_cross, lookback);

plot signal = if bull_lookback then 2 else if bear_lookback then 1 else 0;
signal.AssignValueColor(if signal == 2 then Color.Dark_Green else if signal == 1 then Color.Dark_Red else Color.Dark_Orange);
AssignBackgroundCOlor(if signal == 2 then Color.Dark_Green else if signal == 1 then Color.Dark_Red else Color.Dark_Orange);
 
@Andygray8 Your code works fine... Did you create a Custom Column in your Watchlist and add it to the Watchlist...??? Check out column test2...

1hXvIWx.jpg
 
Last edited:
@Andygray8 Your code works fine... Did you create a Custom Column in your Watchlist and add it to the Watchlist...??? Check out column test2...

1hXvIWx.jpg
OK looks to be working and I've got a couple different watch lists. Thanks all for the help! Is it possible to save different watchlists for example one WL with custom columns for 10,15 and 30min crosses and one for 1hr, 4hr and daily crosses? ToS doesn't seem to have an easy "Copy Watchlist" function. Do you guys just leave detached windows up when you close out they reappear?
 
@Andygray8 Yes, any detached watchlists that are on your screen when you close TOS, generally reappear when you sign back in.
However, it isn't possible to save your detached watchlists once you 'x' out of them, they are gone.

I am SO ATTACHED to my MANY watchlists. It would take me hours to re-create them. I also have a detached message center, monitor, scanners, etc.. so it's important to me to save my workspace. All your detached items are preserved that way.

I have different workspaces filled w/ different charts and watchlists depending on whether it is an Up Market Day and I am running w/ the bulls
or a down-down day and I am playing with the bears.

You can save as many different setups as you want.
https://intercom.help/simpler-tradi...-settings-in-tos-exactly-the-way-they-are-now
 
Last edited:
Hi All,
This is my first post, let say that you guys create some amazing scripts. Maybe someone has this they can share, I have looked for it in the search but can't find it. I am looking to create a watch list when the bar closes above the 50 day EMA its Green and when it close below the 50 day EMA its Red otherwise its Orange. Looking for this on an hour time. I wouldn't imagine this is very complicated but I am no coder.

Any help but be appreciated.

Thanks,
Erik
 
@Erik16 Here you go. Default is being set to 9 EMA. Feel free to change it to your desired length in the script.

mwxZhzT.png


Code:
#
# TD Ameritrade IP Company, Inc. (c) 2017-2020
#

input price = close;
input length = 9;
input displace = 0;

def AvgExp = ExpAverage(price[-displace], length);
def UpSignal = price > AvgExp;
def DownSignal = price < AvgExp;

plot ema = AvgExp;
AssignBackgroundColor(if UpSignal then color.dark_green else if DownSignal then color.dark_red else color.black);
 
@xad The script posted on the first page of this thread will only include the crossover status if it happens within the last 5 bars. You can decrease/increase this rate to your liking.
 

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