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)