Madrid

Madrid Trend Strength

MTS
590
mts
This indicator displays a vector that measures the direction and the strength of a trend. It is based on the Awesome Indicator (AO), the difference is this indicator can be customized to track different moving averages and keep track of either long or short term trends. It displays momentum direction too.
The parameters needed are two mandatory and three optional.
1. Fast MA Length. The length of the fast Moving Average
2. Slow MA Length. The length of the slow Moving Average (SlowMA > FastMA)
3. Signal Length. This is used to display the momentum.
4. Display Signal. Optionally the signal to determine momentum can be displayed as well.
5. Reverse view.
The default parameters are 34-89, but the values depend on which MA pairs you want to study, like 8-21, 21-55, 55-89, 55-144.
How to trade with the MTS indicator
1. Go long when the indicator is green
2. Go short when the indicator is red
3. If MTS is >0 and green : Long position
4. If MTS > 0 and red : entry/exit points. Take profits or scale up
5. If MTS < 0 and red : Short position
6. If MTS < 0 and green : entry/exit points. Take profits or scale up

Momentum Bar:
Lime = an uptrend in progress
Green = Still in uptrend but this signals a weakening trend or a possible reversal
Red = a downtrend in progress
Maroon = Still in downtrend but this signals a weakening trend or a possible reversal

开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
// Madrid : 02/21/2104 : TrendStrength : 2.0 : This meassure the percentage
// Madrid : 05/29/2014 : 2.1 : Added the MTM indicator.
// Madrid : 05/31/2014 : 2.2 : Replaced src hl2 instead of close
// Madrid : 05/31/2014 : 2.3 : Parameter consolidation
// of the difference between two moving averages and determines the 
// strength and direction of the price move.
// The greater the number the stronger the move. A gray area is defined 
// around 3.5%, below this mark the market may become choppy.
// The Madrid Trend Strength Oscillator is based on the Awesome Oscillator,
// the difference is that the Madrid Trend Strength uses ema instead of sma
// which reduces the lagging of the sma.

study(title="Madrid Trend Strength", shorttitle="MTS", precision=2)
src =  hl2

// Input parameters
fastMALength = input(34, minval=1, title="Fast Length")
slowMALength = input(89, minval=1, title="Slow Length")
tsMA = input(13, title="Trend Strength MA")
displayMA = input(false, title="Display Trend MA")
reverseView = input(false, title="Reverse View")

fastMA = ema(src, fastMALength )
slowMA = ema(src, slowMALength )
trendStrength = reverseView? -1*(fastMA - slowMA)*100/slowMA : (fastMA - slowMA)*100/slowMA
threshold = 0
trendStrengthMA = sma(trendStrength, tsMA)

momentum = trendStrength-trendStrengthMA
colorMom = momentum>0 and change(momentum)>=0 ? lime
           : momentum>0 and change(momentum)< 0 ? green
           : momentum<0 and change(momentum)>=0 ? maroon 
           : momentum<0 and change(momentum)< 0 ? red
           : gray

colorTrend = change(trendStrength) > 0 ? green : red

// Output
plot(trendStrength, color=colorTrend, style=histogram, linewidth=2, title="TrendStrength")
plot(0, color=colorMom, style=line, linewidth=3, title="Divergence")
plot(displayMA?trendStrengthMA:na, color=change(trendStrengthMA[2])>0?green:red, linewidth=3)