How it Works?
On each bar it creates a channel by highest/lowest point of a MA. highest point is upper line and lowest point is lower line of the MA channel,
It gets highest and lowest point of last 300 bars, (say )
If the width of MA channel is greater than certain rate of then it decides there is trend
After it decided there is trend, it calculates the rate between channel and MA. Bigger result means stronger trend.
According to rate of MA channel and the , MA Line becomes lighter/darker. so when you look at the MA Line's color you can see the trend strength.
Some details about my idea:
You can choose following MA types as source: , , RMA, ,
"Period to Check Trend" is the period to create MA channel. Bigger period cause more sensitivity.
"Trend Channel Rate %" is rate of . created by using highest/lowest of last 300 bars. I did this to make the script works on all time frames correctly.
"Use Linear Regression" is used to get rid of noise. it may cause 1-2 bars latency.
Trend Following Bar script:
All comments are welcome!.
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.