munkeefonix

TRIX MA

643 3 100
Updated vesion of the script including the crossover in the background can be found here:
TRIX with Moving Average


Trix with a EMA or SMA .

Length: Length of the Trix
Use Ema: True will use an ema, false will use an SMA .
Moving Average: Moving Average used on the TRIX Value.
Histogram Multiplier: Exaggerate the difference between the TRIX and Moving Average .
Remove from Favorite Scripts Add to Favorite Scripts
study("TRIX Moving Average", shorttitle="TRIX MA")
//  Trix with a EMA or SMA. 
//
//  @author munkeefonix
//  https://www.tradingview.com/u/munkeefonix/
//
//  inputs:
//  Length: Length of the Trix
//  Use Ema: Use an ema or sma.
//  Moving Average: Moving Average used on the TRIX Value.
//  Histogram Multiplier: Exaggerate  the difference between the TRIX and Moving Average.

_length=input(15, title="TRIX Length", minval=1)
_useEma=input(true, type=bool, title="Use Ema")
_ma=input(9, title="Moving Average", minval=1)
_mult=input(2.0, type=float, minval=1, title="Histogram Multiplier")

tema(a, b)=>ema(ema(ema(a, b), b), b)
trix(a)=>((a-a[1]) / a[1]) * 10000

_trix=trix(tema(close, _length))
_trixs=_useEma ? ema(_trix, _ma) : sma(_trix, _ma)
_trixh=(_trix-_trixs)

hline(0, color=#000000, title="Zero Line")

plot(_trixh * _mult, color=#000000, style=area, transp=80, title="Histogram")
plot(_trix, color=#FFCC00, title="TRIX")
plot(_trixs, color=#CC0000, title="TRIX Moving Average")
plot(cross(_trix, _trixs) ? _trix : na, color=white, style=cross, linewidth=2, title="TRIX Moving Average")
ChartArt
2 years ago
I like it. Thank you!

Since I can't code at all, I would be happy if you could update your indicator to add a background color alert for cross overs.
Here is an example:
CCI Crossover Alert
Reply
munkeefonix ChartArt
2 years ago
Thanks for the suggestion. I published an updated version that includes the crossover in the background.

TRIX with Moving Average
+1 Reply
ChartArt munkeefonix
2 years ago
Thanks! That was quick :)
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out