OPEN-SOURCE SCRIPT

Fusion: Trend and thresholds

Updated
This is your basic single moving average but with a "slope" component. The idea here is that once a slope reaches a value great enough you should probably only trade with the trend so this indicator allows you to set that threshold separately for going long and short.

The indicator is designed to display on both the main chart and a separate chart area. If you want to display it on the main chart then the quick way is to just check the "On main chart" option and it will disable off main chart items and then just move it to the main chart.

There's half a dozen or so moving average types to select from so you will probably find one that suits you pretty well.

Once a threshold is reached you will get a signal showing the trend is strong enough where you probably should not trade in the opposite direction.

There is a "normalize" option which will fix the oscillator to a maximum of 100. The upside of this is that you can be more consistent in your settings of a threshold. The down side is that normalization happens over a predefined number of bars so it's a floating number, not an absolute number however I set the number of bars default to 3,000 so it should be pretty close to ideal. I haven't found a perfect way of getting a consistent maximum on the oscillator as a benchmark yet so if anyone has any ideas please contact me and I'll do an update. I may look into using percentage rank instead of normalization.

I like to see it as both an oscillator and on the main chart so I generally have two copies.

The settings are certainly not optimized so set to whatever suits your needs as my defaults will probably be wrong for you.

The code is structured to easily drop into a bigger system so use it as a lone indicator or add the code to some bigger project you are creating. If you do, send me a note, it would be nice to know it's being well used.

Finally, if you find value please do make a comment, give a thumbs up etc.

Enjoy and good luck!
Release Notes
Replaced the use of normalization with percentile rank.
Release Notes
Added a tooltip.
Release Notes
Added option to color trend line with threshold information instead of the default which is just the direction of the trend.

Made a default a little more sensible.
Linear RegressionMoving AveragesTrend Analysis

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 publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer