MACD Bullish & Bearish Crossover Watchlist Column for ThinkorSwim

BenTen

Administrative
Staff
VIP
This indicator will scan for stocks with bearish and bullish MACD crossover on your watchlist and display it via a column. By default, it will look for crossover within the last 5 bars. You can change the lookback period to your liking in the code below. It works on all timeframe. Be sure to select the timeframe you want when adding the script.

Notes:
  • Orange = Neutral. No crossover within the last X bars
  • Red = Bearish crossover within the last X bars
  • Green = Bullish crossover on MACD within the last X bars
fsstyZX.png


thinkScript Code

Rich (BB code):
# WalkingBallista MACD Lookback Cross
# https://usethinkscript.com/d/191-macd-bullish-bearish-crossover-watchlist-column-for-thinkorswim

declare lower;

input lookback = 5;
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;

def Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
def Avg = MovingAverage(averageType, Value, MACDLength);

def bull_cross = value crosses above avg;
def bear_cross = value crosses below avg;

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);

Shareable Link

https://tos.mx/pFX3vh

9qEjpEk.png


Credit:
 
Last edited:

mrmac

New member
Hi, apologies in advance for what might be a basic question but where do I input the script for this watchlist please? I am pretty new to Thinkorswim so still finding my feet and have created a standard watchlist but the section to open / create this particular option with the MACD crossover script eludes me right now.
Thank you
 

BenTen

Administrative
Staff
VIP
@mrmac It's under Watchlist > Customize > Custom Quotes. Select one of the option in there and paste the code in. Also, be sure to adjust the timeframe.
 

BenTen

Administrative
Staff
VIP
@dd1111 That’s one way to blow up your account, for sure. Read up on the MACD indicator and what the crossovers mean before using this watchlist column.
 
D

Deleted2090

Guest
Is this code portable for the scanner tab? Do a bullish crossover on a timeframe or a bearish one?
 

Bill1000

New member
It looks only working on daily time frame; Not working on hour or miniuets. Can you please fix it? Thank You!
 
Hello. I was wondering if there was a way we can have a MACD watchlist column when the value is greater than the average it turn green and vice versa red...thanks!!!
 

Similar threads

Top