Moving Average Crossover Watchlist Column for ThinkorSwim

Sticks-N-Bones

New member
VIP
@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
 

alucarrd

New member
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

New member
@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);
 

MerryDay

Administrative
Staff member
Staff
VIP
@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
 

rad14733

Well-known member
VIP
@alucarrd Just be aware that Custom Wartchlist Columns only update every 3 - 7 minutes rather than instantaneously like Standard Watchlist Columns and Charts...
 

alucarrd

New member
@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

New member
@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.
 

J007RMC

Well-known member
2019 Donor
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
 

Madhu

Member
VIP
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

Member
VIP
@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 .
 

rad14733

Well-known member
VIP
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...
 

Madhu

Member
VIP
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

Top