+ REX Oscillator

ClassicScott Updated   
So, what is the REX oscillator, you might be asking yourself.
"The Rex oscillator is an indicator that measures market behavior based on the relationship of the close to the open, high and low values of the same bar. A big difference between the high and close on a bar indicates weakness, and wide disparity between the low and close indicates strength. The difference between open and close also indicates market performance."

The True Value of a Bar (TVB) gives an indication of how healthy the market is. A negative close and a positive TVB (or vice versa) is an indication of the market building strength on the opposing side of the trend. The Rex oscillator is a moving average of the TVB value with the specified period.

I first came across this watching one of many No Nonsense Forex videos. Mostly, from comments I've read, it is used as an exit indicator for people who trade with a system similar or identical to the one VP espouses in his NNFX blog. I think it's perfectly apt to use as an entry indicator as well, or even as both, perhaps, depending on the moving average you chose to apply to the TVB.

There are a few other versions of this on tradingview, but I thought I'd make an updated version. Added Donchian Channels because I like the idea of a dynamic sort of overbought/sold area. I left out the basis because the indicator pivots around a center line, and has a signal line as well. A basis line just seemed like too much, and would likely not be very useful.

The additional usual things that I incorporate into my indicators are included here: optional candle coloring, alerts, and probably a too large selection of moving averages.

Credit to Nemozny for the FRAMA calculation. I may add that to other indicators I have.
Release Notes:
a user mentioned to me a tweak that I should make to the Jurik Moving Average, so I have done so. It's a simple thing, changing the power value from an integer to a float so that you can fine tune the MA more so than whole integers would allow.

also made the donchian channel band thickness adjustable. Anywhere from 3 on up is fine. Once you get past around 8 it's pretty negligible changes though. Smaller numbers are wider (2 would basically start the bands at the basis), and the bands can only go so thin, hence why anything beyond 8 doesn't change much.
Release Notes:
made a few minor tweaks in the case of language, but the big update, as suggested in the comments (and something I was thinking about implementing anyway) is adding divergences to the indicator. Thanks to AtomOfScent for the suggestion (and also the suggestion for the change in the JMA).
I've actually added this across all my oscillating indicators, because why not. In the case of the REX Oscillator I've set it so that you can set divergences to plot from either the REX or the Signal Line.

Release Notes:
added alert conditions for divergences
Release Notes:
-conversion to pinescript v5
-added T3, RMA, and UMA moving averages for REX and as signal line
-added option for plots for signal line crosses
-added histogram option. This works the same as it does for MACD. It's just measuring the distance between the REX and Signal line
-histogram is also selectable as a candle coloration option and as a divergence option
Release Notes:
-added an alert for histogram crossing the center line

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?