jth88

Market Trend using First Derivative of MAs + Volatility

jth88 Updated   
Based on Smooth First Derivative Indicator by tbiktag
Volatility also from another public TV script, forgot which one though, sorry if this is yours and I haven't credited your work, let me know if it is and I'll reference it properly.

About this indicator:

Estimates whether market is trending up, down or sideways by adding the slope (first derivatives) of a fast & slow MA. Uptrend = Green, Downtrend = Red, Sideways = Yellow

Uses a minimum slope percentile to determine threshold for uptrend, downtrend & sideways. Definitely adjust this when changing timeframes, for BTCUSD at 1 hour timeframe a value of 25 is decent
Also has a measure of Volatility if you're into that

Explanation of inputs:
Bandwidth - for derivative function
Fastma - period for fast Moving Average
Slowma - period for slow Moving Average
Derivmalength - smooths out the signal, reducing single contrasting bars, but delays the signal. Use 1 if don't want to use
V length - ema of volatility if you want to smooth it
Min Slope Percentile - slope should exceed this percentile to be classified as uptrend (green) or downtrend (red) anything in this bottom percentile will be considered sideways
Mine Slope Lookback Period - # of bars back to calculate Slope Percentile
Release Notes:
Fixed Min Slope Percentile error, now properly goes from 1 - 100
Release Notes:
Added option to use Squeeze Momentum based derivative to determine trend (less laggy but maybe requires a lot more tweaking to properly identify ranging zones). By default it's still MA-based derivatives.
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.

Disclaimer

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?