Moving Average Crossover Watchlist Column for ThinkorSwim

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

@Sticks-N-Bones So..... You are looking for something like one of these columns?
3O3rKSo.png

Ruby:
# Code for the 1st column

def signal = close / MovAvgExponential("length" = 40)."AvgExp" *100 ;
AddLabel(yes, " ");
AssignBackgroundColor(if signal > 100 then color.green else color.red);

Ruby:
# code for the 2nd column

plot signal = close / MovAvgExponential("length" = 40)."AvgExp" *100 ;
AssignBackgroundColor(if signal > 100 then color.green else color.red);
HTH

You NAILED it! Thank you!! I actually didn't mean to have you multiply by 100 in the code but I easily removed it. Thank you again
 
Hi @BenTen , first of all, great community you have here. Thank you for creating this community. I am trying out your customize column for watch list to show bullish and bearish when 9ema crosses over 20 ema. I took your script from this post and simply changed the ema values. However, after I added the column in my watch list, it seems like they only stay as orange (neutral). Can you possibly give me some pointer on what could be wrong?
 
@alucarrd Could you please provide your exact code that 'only stay as orange' so someone can troubleshoot it for you?
 
@MerryDay
I have only modified the value for input on ema here...

Code:
# WalkingBallista EMA Lookback Cross
# https://usethinkscript.com/d/119-moving-average-crossover-watchlist-column-for-thinkorswim

declare lower;

input lookback = 5;
input ema1_len = 9;
input ema2_len = 20;
input averageType = AverageType.EXPONENTIAL;

def ema1 = MovAvgExponential(length = ema1_len);
def ema2 = MovAvgExponential(length = ema2_len);

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

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);
 
@alucarrd
I found that your code works fine. If you think you are getting bad results, plot 9ema and 20ema on a chart. If the chart shows one thing and the watchlist shows another, post marked-up screenshots of the chart and watchlist and we will help you troubleshoot further.
ztXY0Xq.png
 
@alucarrd Just be aware that Custom Wartchlist Columns only update every 3 - 7 minutes rather than instantaneously like Standard Watchlist Columns and Charts...
 
@alucarrd Just be aware that Custom Wartchlist Columns only update every 3 - 7 minutes rather than instantaneously like Standard Watchlist Columns and Charts...
Hi @rad14733, that must be it then. Last nite, I was testing it out through the ondemand feature. I am guessing this type of ondemand replay data doesn't go through the proper route, that's why the column did not update for me last night. It works great this morning except the lag. So your explanation make sense.
 
@alucarrd
I found that your code works fine. If you think you are getting bad results, plot 9ema and 20ema on a chart. If the chart shows one thing and the watchlist shows another, post marked-up screenshots of the chart and watchlist and we will help you troubleshoot further.
ztXY0Xq.png
Hi @MerryDay,

The column works great this morning except some lag. I am guessing i will just have to make the best out of it. Thank you for helping out.
 
One for arrow up and arrow down

Code:
declare upper;

input fastPeriod = 3;
input slowPeriod = 10;
input signalPeriod = 5;
input price = close;

def fastEma = ExpAverage(price, fastPeriod);
def slowEma = ExpAverage(price, slowPeriod);

def _ppo = ((fastEma - slowEma) / slowEma) * 100;
def _signal = ExpAverage(_ppo, signalPeriod);

plot BUY = Crosses(_ppo, _signal, CrossingDirection.ABOVE);
plot SELL = Crosses(_ppo, _signal, CrossingDirection.BELOW);

BUY.setpaintingstrategy(paintingstrategy.BOOLEAN_ARROW_UP);
SELL.setpaintingstrategy(paintingstrategy.BOOLEAN_ARROW_DOWN);
##End
 
Hi Ben,

I am looking for a watch list- with yes/ no when em1(8) > ema2(21)>ema3(50).

Can you please help me on this?
 
@Madhu Just change the values from the original code to 8 and 50.

Hi Ben,
I am not sure if my earlier question was clear
I am using 8,21,and 50 Ema.i want to take trade when 8 ema is above the 21 ema and 21 is above the 50 ema. All these conditions are met then show them in watch list .
 
Hi Ben,
I am not sure if my earlier question was clear
I am using 8,21,and 50 Ema.i want to take trade when 8 ema is above the 21 ema and 21 is above the 50 ema. All these conditions are met then show them in watch list .
How would ema8 be greater than ema50 and not greater than ema21...??? 💡 But if you need the logic it would be ema8 > ema21 and ema21 > ema50...
 
Yes Ben, I am looking for ema8 > ema21 and ema21 > ema50...
Hi Ben, i need to show if they moving avg are showing in a order - 8 , 8 below 21 ,21 below 50. If these three conditions are met show in a watch list with some me color indication. Could you please help me on this?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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