• Memorial Day Sale! Claim the biggest discount of the year with $50 off VIP using code MEM50. Sign up here.

EZ Trend and Momentum Indicator for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Great oscillator which determines trend and momentum. So accurate it could be used as a stand alone indicator.

Remove the assignPriceColor line in the code if you wish not to have the candles painted.

HcygLiG.png

TUTNyTv.png


thinkScript Code

Code:
# EZ Trend & Momentum
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/IzvxaVhB-ROMI2/

declare lower;

def s2 = expAverage(close, 10) - expAverage(close, 24);

plot line = s2;

line.assignValueColor(if s2 <= 0 then color.red else color.green);

assignPriceColor(if s2 <= 0 then color.red else color.green);
 

BenTen

Administrative
Staff member
Staff
VIP
@veerasareddy If it works for SPY, it will work for other stocks and vice versa. Unless you find some concept that only applies to SPY, then I can take a look and see if I can convert for you.
 

JohnsonM

New member
Hi Ben. Is it possible to change current trend and momentum set up from colorbars to a histogram? Keen to know how to do this as well on the slimribbon.
 

BenTen

Administrative
Staff member
Staff
VIP
@JohnsonM Add this snippet to the bottom of your script:

Code:
line.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
 

BenTen

Administrative
Staff member
Staff
VIP
@JohnsonM No idea about the Slim Ribbon indicator since I don't use it. However, I believe those are moving averages. You can post a request in that thread.
 

Trading51

Active member
2019 Donor
Can you add a feature so we can only get the colored bars the lower indicator is not needed the colored bars work great on the 5 min
 

camerdr

New member
@BenTen

Thanks for this script. How can I convert it into a scanner that scans for changes in the line color within 1 to 3 candles?

Thank you.
 

BenTen

Administrative
Staff member
Staff
VIP
@camerdr Here you go, load up the indicator in the scan tab, then use a condition like this:

BhSRF3H.png


That's a bullish scan. Use less than or equal to if you want to scan for bearish signal.
 

BenTen

Administrative
Staff member
Staff
VIP
@Dom173 Add the following snippet to your script, right below declare lower;

Code:
input aggregationPeriod = AggregationPeriod.DAY;
def close = close(period = aggregationPeriod);
 

Similar threads

Top