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 , bar color becomes lighter/darker. so when you look at the bar color you can see the trend strength.
Some details about my idea:
You can choose following MA types as source: EMA, , RMA, , VWMA
"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.
All comments are welcome!.
when there is uptrend or downtrend we must know the strength of the trend. to see trend strength the script makes the colors lighter or darker. lighter color means strong trend. I hope all clear now :)
ma5 = gettrend(5)
alertcondition(ma5 > 0, title='MA 5 Up', message='MA 5 up')
alertcondition(ma5 < 0, title='MA 5 down', message='MA 5 down')
alertcondition(ma5 == 0, title='MA 5 no trend', message='MA 5 no trend')