munkeefonix

TRIX with Moving Average

Updated version of the Trix to include crossover on the background.

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 v2", 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")
_filter=input(0.0, type=float, minval=0.0, title="Near Zero Filter")

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)

bgcolor(_trixh[1] >= 0 and _trixh[0] < 0 ? red : _trixh[1] <= 0 and _trixh[0] > 0 ? blue : na)

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
Thanks again. The reason why I asked for the background color alert is because now I can add that alert in the background to the main chart, when I turn all other options off. See my example here:

snapshot
Reply
ChartArt ChartArt
2 years ago
There are some interesting results, when you change the TRIX length to 100 or 200 in the daily chart and then zoom out to years:

TRIX 100
snapshot


TRIX 200
snapshot
Reply
munkeefonix ChartArt
2 years ago
I haven't really relied on the cross over much since it often times seemed to be a bit slow for how I tend to trade. I added an example of where I've used TRIX and how it factored in. The way I've used it does give some false signals, especially around the zero line. So I'll use fib levels, rough Elliot Wave count, harmonic pattern, or a coin flip to figure it out.

snapshot

Reply
ChartArt munkeefonix
2 years ago
Yes, the indicator with the settings you provided is way too slow. That is why I experimented with other settings.
Reply
munkeefonix ChartArt
2 years ago
When I get a chance I'll do a bit of experimenting and see if I can get a quicker signal out of it. I'll probably create another variation of the TRIX to combine a couple of the signals from here: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:trix

Might give some more reliable results.
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